0 Favourites

generate random coins over obstacles

  • Hi i have a problem which is i made a game that random floors coming from the right side of the screen and the character have to jump on the floors in order not to fall.. The problem is that I want to spawn random number of coins over each floor randomly, and each coin would keep distance of few pixels of each other and I want to determine the amount of coins if it's possible too.

    you can see it in this game:

    youtube.com/watch

    would like to see an example

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Any help please?

  • shadowfan33 I could be wrong, but those coins don't look random. If it's an endless runner, it may be grabbing random floor chunks, but those coins looked precisely placed for a better platforming experience. They probably had something scripted to grab a specific coin layout for a specific length of floor.

    That's not the example you requested, but if this game is what you're looking for, it's probably more crafted than it appears.

  • GabeOfThrones Maybe you right but still i need some example, my event is creating too many coins, always making them appear on each other and it dosen't look nice and even bad. I want to spawn like 5 for each floor and that they will keep an equal distance of pixels from each other like lined up soldiers. I'm stuck with this problem and can't continue my game..

  • shadowfan33 If you want 5 to spawn for each floor you could write a simple "for" loop that spawns and positions the first one above the floor in a particular spot and increments the X by your desired amount for the subsequent coins. If you want the position of the whole 5 coin chunk to move around some, you could figure out a range for the starting position and randomize the X and Y for that. You could also randomize the number of coins in a row just by limiting the for loop.

    Simple example:

    <img src="http://www.gabemiller.com/images/coinhelp.jpg" border="0" />

  • you might be better off just making like 3-5 platforms off screen of course and use Pink invisible square to have math code to random select the platforms and with it you should just pin the coins on top of each one using image point i believe ?

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