Page 1 of 1

Random positions

PostPosted: Mon Apr 20, 2015 8:31 pm
by fathybasha
I want to make an item to spawn at a random position on the right side of the map.

I want it spawn at random position on the right side only please!

Help will be appreciated.

Re: Random positions

PostPosted: Mon Apr 20, 2015 9:15 pm
by mindfaQ
creat object
set position to x = random(scrollx, scrollx + originalwindowwidth / 2); y = random(scrolly - originalwindowheight/2, originalwindowheight))
Or if you mean the right edge of the screen for x it is not random, but just scrollx + originalwindowwidth / 2

hope I didn't make a mistake. scrollx and scrolly should be the middle of your window and half of the screen width added, you will be at the edge; for your understanding.

Re: Random positions

PostPosted: Tue Apr 21, 2015 5:02 am
by fathybasha
I am sorry i didn't explain that,i meant it would have a bullet behavior then spawn on the right of the layout then move to the left of the layout.

Help again please!
mindfaQ wrote:creat object
set position to x = random(scrollx, scrollx + originalwindowwidth / 2); y = random(scrolly - originalwindowheight/2, originalwindowheight))
Or if you mean the right edge of the screen for x it is not random, but just scrollx + originalwindowwidth / 2

hope I didn't make a mistake. scrollx and scrolly should be the middle of your window and half of the screen width added, you will be at the edge; for your understanding.

Re: Random positions

PostPosted: Tue Apr 21, 2015 5:57 pm
by puntodamar
you can use wrap behaviour