How do I make a created object go the opposite direction

Get help using Construct 2

Post » Fri Sep 25, 2015 6:57 am

I am creating the same object every second and they are all set to move to the right a a certain speed. I am simulating the right button down on every tick as long as the direction variable I made is equal to 1 (0=not moving, 1=move to the right, 2=move left). My question is, how do I change the direction of movement of the objects that are already created? Basically when I press a button that switches the variable to 2 I need all the objects created to move left instead of just the objects that are about to spawn. Any way to do this?
B
5
S
1
Posts: 35
Reputation: 445

Post » Fri Sep 25, 2015 8:46 am

I hope I understood the question correctly. It would easier to answer if you had provide a capx.
But what I understood so far, you could use: System Pick all (your objects) -> set direction=2
Then all instance variables of your objects should be set to two.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Fri Sep 25, 2015 9:31 am

You don't even need to "pick all" the objects.
By default and in regards to how events work, simply setting the action Object - set Instance variable "direction" value to 2 in an event "on key pressed" should do the work.

This won't impact "instances to be created" since the key press is a triggered event and only applies to existing instances.

If this does not help, do post your capx as specificities of the project might get in the way somehow.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
293
S
117
G
96
Posts: 7,310
Reputation: 71,069

Post » Fri Sep 25, 2015 10:42 pm

I still can't seem to get them to move the opposite direction. Here is a .capx. Obviously it would be appreciated if you didn't copy my (less than brilliant) ideas. Thanks!
B
5
S
1
Posts: 35
Reputation: 445

Post » Mon Sep 28, 2015 6:15 pm

Hate to bump, but can anyone help me?
B
5
S
1
Posts: 35
Reputation: 445

Post » Mon Sep 28, 2015 8:20 pm

I tried something and it works, but I don't know if it is exactly what you want. I changed a little bit and don't use the 8Dirction-Behavior and I have a little bit problems with wait. So I have to use a Direction 0, because if I put the wait from Direction 0 in Direction 2 it doesn't work. Maybe a more advanced programmer could say why.

https://drive.google.com/file/d/0B5FlDY ... sp=sharing
B
24
S
3
G
1
Posts: 454
Reputation: 2,171


Return to How do I....?

Who is online

Users browsing this forum: Albatr, raptor0555, Syazanie Amirin and 43 guests