How do I fix this event ?

  • So i am making a layout where inorder to access the 2nd side of the map you need to go through a portal and press Space on released.

    Now i used the same coding for the other portal so its like this Portal A ----> Portal B with space release and then Portal B---->Portal A with space release.

    Apparently these event are looping on space release. I even rename the sprite created two different sprite and created two different animation frame to have the condition to check.... IT still looping what gives ?

    Another thing i need to point out is that yes i can go Portal A to portal B but apparently the game thinks to do Portal B to Portal B.

    And yes i did test with two different button press and it work fine. My question is why is it not working with just space release for both ? even if the condition are different. Is it a bug ?

  • Here's how I would do it:

    On space release

    Run once while true

    -is overlapping portalA

    +set position to portalB

    -is overlapping portalB

    +set position to portalA

  • Your code runs all at once in order from top to bottom. If you're on A and you hit space release to go to B, you will go to B, but since the code is still running, you already let go of space once, but the code still sees it, so it says "Oh now you're on B so let's put you on A".

    I'm not very technical with my words but at least I try to put it in laymans terms lol

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Eeerrrr I cannot do the once while true ? says that I cant have space bar as release ? that doesn't make any sense

  • "Trigger once while true" and the on key release conditions are both triggers -- indicated by the green arrow -- and you can only have one trigger per event. This is also true of subevents to events with a trigger.

  • ok i solved it ... by adding in two Lever ....To go this far is pretty weird. Never the less it made my game look better lol

  • Oh I was going to suggest this. Where you have a instance variable that holds what to Teleport to. So then you have to code it once and it would look at the instance to which teleport it suppose to go to. **EDIT Fixed it wasn't necessary for the variable

    [attachment=0:l0le4ev4][/attachment:l0le4ev4]

  • IDK, Trigger Once doesn't have a green arrow for me, and never has, so my explanation should hold up. I use it all the time.

  • So i am making a layout where inorder to access the 2nd side of the map you need to go through a portal and press Space on released.

    Now i used the same coding for the other portal so its like this Portal A ----> Portal B with space release and then Portal B---->Portal A with space release.

    Apparently these event are looping on space release. I even rename the sprite created two different sprite and created two different animation frame to have the condition to check.... IT still looping what gives ?

    Another thing i need to point out is that yes i can go Portal A to portal B but apparently the game thinks to do Portal B to Portal B.

    And yes i did test with two different button press and it work fine. My question is why is it not working with just space release for both ? even if the condition are different. Is it a bug ?

    i wold say exactly what people above sayd, use 'trigger once while true' condition, and change from when released to when pressed on released its to hard for c2 to reconize sometimes better use the when pressed condition, always performs better.

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