How do I place coin bundles for an endless runner

Get help using Construct 2

Post » Wed Jan 04, 2017 1:00 pm

Hey there!

Currently iam working on an endless runner - i want to ask, if there is a nice solution or workaround for placing coins, the player can collect, and which will be renewed later and collected again (it should be possible to spawn the same container gain). I dont want to spawn single coins - it would be great if there would be "coin containers " like you could do with prefabs in unity or sublevels in adobe flash/animate with an dimension of - for example: 5 x 6 coins" - or coins ordered in an rainbow shape (which animates the player to jump over an obstacle). I hope you know what iam looking for. Basically i want to get a set of differend coin containers and spawn them randomly after some time or distance.

Another thought was: If i would set each coin for itself - every coin would have a bulled behavior on it, which may caused into performance issues. If i would have one main container i would move, and all the children would move based on its coordinates, there would be probbably less performance influence.

Thank you very much for your answer!
Posts: 147
Reputation: 1,041

Post » Wed Jan 04, 2017 8:04 pm

You can use arrays of relative coin positions.

eg an array [container_id] [coin_id] [pos]:

// coin 0 of container 0
array[0][0][0] = 0 // relative x-pos
array[0][0][1] = 0 // relative y-pos

// coin 1 of container 0
array[0][1][0] = 10 // relative x-pos
array[0][1][1] = -3 // relative y-pos

// coin 2 of container 0
array[0][2][0] = 22 // relative x-pos
array[0][2][1] = -6 // relative y-pos

// coin 3 of container 0
array[0][3][0] = 36 // relative x-pos
array[0][3][1] = -10 // relative y-pos

you can create different shapes for the container with the relative coin ositions.
then create the (random) container coins relative to the initial position.
Image Image Image
Posts: 379
Reputation: 12,254

Post » Sun Mar 05, 2017 8:40 am

Hi there, me also very interested in this method, but understand nothing... may be someone can provide a simple .capx? Please...
Posts: 40
Reputation: 1,687

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, dand, tinhofiel, Yahoo [Bot] and 29 guests