Random positions

Get help using Construct 2

Post » Mon Apr 20, 2015 8:31 pm

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.
B
15
S
4
Posts: 153
Reputation: 1,385

Post » Mon Apr 20, 2015 9:15 pm

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.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Tue Apr 21, 2015 5:02 am

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.
B
15
S
4
Posts: 153
Reputation: 1,385

Post » Tue Apr 21, 2015 5:57 pm

you can use wrap behaviour
"If you want to move a mountain tomorrow, you should start by lifting stones today."
B
64
S
14
G
2
Posts: 291
Reputation: 6,666


Return to How do I....?

Who is online

Users browsing this forum: 25games and 20 guests