Hi all! i want that the system create a sprite every x seconds in left or right of the layout..
what condition i've to use?
my layout in this game is 800x600
every random(x,x) sec----> create object on layer x at X(random(-400,0))
every random(x,x) sec----> create object on layer x at X(random(800,1200)
As I said, i want to create this object on left or right, so how can i combine these two conditions?
Up! I need a condition to create a object in random position on the left or right of layout, please help me!
By having them one after another you are doing just that,
its creating on on the left, then one on the right.
to make your events a bit cleaner you could change it to
create object on layer 1 at -100, random(0, windowHeight)
create object on layer 1 at windowWidth +100, random(0, windowHeight)
this way if you change your game resolution you won't have to go update it later.
use the choose function. random creates a random number between 0 and say 800, choose chooses, so create at X = choose(0,800) will pick one: 0 or 800.
Develop games in your browser. Powerful, performant & highly capable.
Create object at X:
choose(random(-400, 0), random(800, 1200))
Ah!!! The oobject when is created go in direction of layout with bullet behavior... maybe i can't use this :(