Random Between: using random with the instance_create function in GML

Posted by CLockeWork on Game Development See other posts from Game Development or by CLockeWork
Published on 2013-05-25T02:22:06Z Indexed on 2013/06/29 10:30 UTC
Read the original article Hit count: 666

Filed under:
|

Hopefully this should be a simple one; I want to restrict the points that instances enter the screen from so they don't come in at the edges.

In Game Maker I'm using the following code instance_create(random(room_width), random(-100) - 50, obj_enemy1); to create the instance off screen (create(x, y, ...))

At the moment I'm just using the room_width to define the max width for the random on x, but ideally I want to find a way of defining a max AND min width for the random. I can't figure out how to restrict the range on the x axis to between say 100 and 350.

Any help would be appreciated.

Cheers

© Game Development or respective owner

Related posts about random

Related posts about game-maker