SOLVED - How do I set player Y based on boolean?

0 favourites
  • 9 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi everyone, hope you are doing great, hopefully you can give me a hint on this one, sounds super easy, but I have tried several methods without much luck.

    I would like to make an endless runner game, but the ones that you can change positions on Y while playing

    I have a boolean that makes the player change Y position. But once it does, it is stuck on the Y position I just gave him.

    How can I make this event only play once? (Set Y, and then leave the player on its own again ¿?) I have confronted this before on other examples, hopefully I will be able to understand it someday

    Do you think this would be the correct approach or should I change the method?

    Thank you so much in advance :) Best Regards, J

    Tagged:

  • Hey there, you didn't add any condition/action to turn off the boolean, that's the problem

  • Thanks so much for your answer, Tomy

    I guess I am having a missunderstanding that goes deeper than this example... shouldn´t toggle boolean work like a switch?

    If it´s true, turn if false, and if it´s false turn it true?

  • Oh I missed the "toggle" action, it should work that way, try to replace Else with inverted boolean?

  • Hello,

    I will attempt to assist you here but I for one, don't use event sheets and two, you have two contradicting statements.

    have a boolean that makes the player change Y position. But once it does, it is stuck on the Y position I just gave him.

    How can I make this event only play once? (Set Y, and then leave the player on its own again ¿?)

    Looking at your event sheet I am going to assume the player is stuck at the first Y position.

    You have 4 individual conditions, and they all run once, apart from the first condition where your setting your X position.

    You can have multiple conditions to an action. Here is what I think I understand you need to do.

    Condition #1 - Keep as it is.

    Condition #2 - Add a second condition to it. So it's Every tick & On Space pressed.

    Condition #3 - Add a second condition to it. So it's Every tick & Is Boolean.

    Condition #4 - Keep as it is.

    Something like this:

  • I thought of another approach to avoid using loops, put event 3 and 4 as sub-events of event 2, instead of toggling the boolean, set it true or false depending of its current value

  • Also thinking about my response. You might not need the tick condition with the keyboard input as the event sheet might do this on a listener anyway.

  • The problem is it's not clear what you're asking. what does this mean? "How can I make this event only play once? (Set Y, and then leave the player on its own again ¿?)"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi everyone, thanks for all your answers, I managed to make the player have its Y position based on boolean

    This is what I did and also I`ll be leaving the c3p file in case someone finds it useful as a starting template :)

    Thanks!

    badablu.com/desarrollo/c3/runner2worlds%20templatejdejean.c3p

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