making a object show up at random spots?

In my game I’m trying to get a object to show up in different spots throughout the game. So far the objects are just in the same spots. Its a side scroller game. Any suggestions?

Thank you to all in advance [import]uid: 80826 topic_id: 22085 reply_id: 322085[/import]

What do you mean by “random spots”?

If it is a side scroller do you have objects moving in from the right and they are always at the same Y coord?

Let me know details and will try to advise :slight_smile: [import]uid: 52491 topic_id: 22085 reply_id: 87793[/import]

Yes the objects are coming in from the right side, and right now the objects are in the same spot. Im trying to get them so they move to random spots through out the level. Its in a json file, where I’m trying to randomize the positions of the items. [import]uid: 80826 topic_id: 22085 reply_id: 87880[/import]

When you spawn them rather than setting their Y as 100 (for example) set it to y = math.random(20,300)

To move to random spots you’d set their x and y as random during their transitions. (Assuming you are using transitions.)

Make sense? :slight_smile: [import]uid: 52491 topic_id: 22085 reply_id: 88001[/import]