Stopping and starting when pressing the same button.

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Code
    User clicks with right button
    Soldier is stopped
    Soldier -> movement start
    
    
    User clicks with right button
    Soldier is not stopped
    Soldier -> movement stop

    This is so simple but it won't work. Does anyone know a way I could make this work?

  • It's because the game quickly checks when you're pressing the button. It will activate both conditions within the time you press the key.

    I would use the key to toggle a flag. Then when the flag is either on or off, switch the movements.


    Sent from my iPhone using Tapatalk

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

  • User clicks with right button
    Soldier is stopped
    Soldier -> movement start
    Flag 0 is off

    User clicks with right button
    Soldier is not stopped
    Soldier -> movement stop
    Flag 0 is off

    Then add an action to each: "Turn flag 0 on".

    Lastly, create an additional event:

    Flag 0 is on: Turn Flag 0 off.

  • User clicks with right button: toggle flag 0

    Flag 0 is ON:
    Soldier movement start

    Flag 0 is OFF:
    Soldier movement stop


    Sent from my iPhone using Tapatalk

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

  • Test position of player. Click all the arrows that point outside the sides of the frame.

    The condition now will read "when active leaves the play area" (or something similar to that)

    Then stop the player.


    Sent from my iPhone using Tapatalk

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

  • When player leaves the play area: set flag off?


    Sent from my iPhone using Tapatalk

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

  • This way will work if you're not using the current status of the timer for anything.

    User clicks with right button
    Soldier is stopped
    Timer is greater than 0.02
    Soldier -> movement start
    Set Timer -> 0

    User clicks with right button
    Soldier is not stopped
    Timer is greater than 0.02
    Soldier -> movement stop
    Set Timer -> 0

  • I think you could just try adding this to Sumo's solution:

    Flag 0 is ON:
    +(limit condition) only one action when event loops
    Soldier movement start

    Flag 0 is OFF:
    +(limit condition) only one action when event loops
    Soldier movement stop


    I guess the soldier doesn't stop at frame borders because it gets constantly "started" while its status is ON

    (but switching constantly while he collides could cause the bug as well, then you may want apply additional code for extra safety)

    a selection of my Fusion examples can be found Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!