How do I pick # or # (not a random range)

Get help using Construct 2

Post » Sat Jan 28, 2017 10:53 pm

I'm trying to set up a random left or right movement once a counter I have set up reaches 0. The thing I need to do is either pick -100 or 100 so that the player will be moved left or right, randomly.

I tried random(-100,100) but it will constantly move left or right because it is picking numbers constantly.

Image
B
13
S
7
G
2
Posts: 65
Reputation: 2,307

Post » Sat Jan 28, 2017 10:58 pm

choose(-100,100)
B
60
S
20
G
56
Posts: 1,077
Reputation: 35,941

Post » Sat Jan 28, 2017 11:27 pm

@Burvey thanks! though I still seem to be getting a repeat loop, whereas it is choosing -100 and 100 so the player moves left and right until it wiggles its way out of the zone. I tried adding "trigger once while true", but that just caused the movement not to happen at all.
B
13
S
7
G
2
Posts: 65
Reputation: 2,307

Post » Sat Jan 28, 2017 11:45 pm

Rather than setting the platform vector x, try just setting player position x.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,579
Reputation: 60,299

Post » Sun Jan 29, 2017 12:11 am

That did the trick @oosyrag, thanks. I had to find the x,y at the bottom of the editor for the 2 x points to pick, but it did the job. I also tried some thing else which also worked:

Image
B
13
S
7
G
2
Posts: 65
Reputation: 2,307

Post » Sun Jan 29, 2017 1:15 am

Just thought, how would I keep the events I have, but apply them to copies of the object that triggers the events? I copied the object but when the player interacts with it like the oringal, nothing happens, though it has the same name, but of course a different ID. Is there a way to copy my object so it does the same as the orginal?
B
13
S
7
G
2
Posts: 65
Reputation: 2,307


Return to How do I....?

Who is online

Users browsing this forum: InfiniteRockets, ksiads, Zav and 6 guests