How do I Random Coins?

0 favourites
  • 3 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hello all constructers!

    I have the 2D runner game. Where the character keeps on running from side to side and needs to jump to climbing up. I would like the following:

    (1) Have random coins (sprite) spread at each other step. That way the character can collect them.

    (2) At even higher levels, the bottom bars (the floor) should start dissolving given a certain amount of time - forcing the character to keep on jumping.

    Your responce will highly be appreciated.


  • Hi.

    This can be done in different ways, I'll only share how I would do it.

    So I assume it is an Endless game, with scroll-to function, and the spacing of each step remains the same. Also, I'm assuming the horizontal movable space of each step is, let's say, 800px.

    For the first coin:

    [On start] Create object (coin) on X: random(800) + 100 and Y: -50

    For random coins after every alternate step:

    [coin.Y > 300, Trigger once] Create object (coin) on X: random(800) + 100 and Y: -50

    A bit of trial and error, or width/height pixel idea will be needed there.

    For the dissolving part... You can create a Particle of small black square, set it to 'One-time only' Rate: 100 (or more), Random X dispersion to 800 pixels, Random Y dispersion to 20. Set the angle downwards (like a gravity effect), Then to make it dissolve [after score > 1000] Make that step spawn that pixel (from the middle of the step), and destroy the step immediately.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Very really really thank you Hasan for your replying.

    The way that you explained is outstanding i really appreciate.

    I got the points and implement it but a little bit stuck with it because i am a very beginner with construct 2, if i share the Capx file with you, would you kindly implement these for me. I will be very thankful to you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)