How do I randomize time/location of sprite

0 favourites
  • 9 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • I am currently working on a mobile game where I am trying t to randomize how the objects come down. There are 5 rows and I have about 20ish objects that i want to randomize.

    These objects fall from the top to bottom of the screen.

    My issue is i have the items randomized to location x(50)y(-1), x(140)y(-1), so on and time 1.2 sec, 1.4 sec, so on, what is happening is i currently have 4 different objects but it would be the same object in each row at each second interval.

    I want it where at any given time its a random object in each row.

    Please see attachments (sorry it was through paint so not perfectly lined up, but you get the idea)

    This may sound confusing im not sure how to properly explain this.

  • Do you want to create random objects in a 5x5 grid?

  • hmmm, I guess that wouldnt be a bad idea. If i would do that would the object fade in and out or what they still come scrolling from the top ?

  • I suggest tha you share your capx

  • I have attached it

  • I saw your project and saw some triangles raining LOL

    Do you want the triangles fall randomly in different intervals and fixed 5 columns?

  • Lol I make it rain lol

    Correct different colored triangle at different intervals in the 5 columns. So when all the objects are added and game is complete at any given time there will 20+ different objects

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do this:

    • Create a Family, and put all your falling objects in this family
    • Create a event with the condition System\Every random(1,3) seconds (you can change the numbers) and the action System\Create object, selecting the Family and Y position a fixed negative value (object will be created outside layout) and X position with choose(10,20,30,40,50) (change these values to match the columns positions).
    • Put Bullet Behavior in Family and adjust its proprieties.
    • Test and have fun!
  • PERFECT!!!

    You are the man, exactly what I needed.

    Another question any way to have a quicker spawn interval, currently i have 0.3 which is perfect bc they dont overlap. Is it possible to spawn them 0.1 but with out already overlapping a current sprite that has been spawned?

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