How do I make a created object go the opposite direction

  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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!

  • Hate to bump, but can anyone help me?

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)