How do I Fix my Character's Movement?

0 favourites
  • 13 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • Hello everyone! I am having a problem with my character on my platformer game. Everytime I use the key pressed A or D at the same time, my character does not move at all and runs the Walk Right animation forever. This also happens when I Jump+A+D. The character jump, moves to the left while in the air, but when I press D it goes straight to the ground and stops moving and plays the Walk Right Animation.

    Any clues on how to fix it? https://gyazo.com/859d7349ec1abdfa03c165a745ddeb84

  • Why is your character direction set to RIGHT when pressing left?

  • well that is because i guess u made the events on release button or once pressed on one of them, is a basic mismatch that most people dont see as how things work in c2... C2 takes every line of code as you lay it down in the event sheet. so if u tell it play animation left for example when A is down its going to do so... as for playing an animation when was pressed... thats a totally different logic... and has a different meaning if u try to understand it a bit more then a quick glance... try swapping from pressed.... to IS PRESSED or IS DOWN that will fix it however... the last key u press is going to be the last that will be triggered so if u press AD and the delay between them is by 000000000. pico something the very next one pressed down will be the one animating ur character.

    for better ease of understanding...

    Was pressed condition triggers one time if the button was sometime pressed and the events or actions are not in play - sometimes they might even overwrite each other but wont be a big glitch or something visible

    IS PRESSED condition triggers if u keep pressed the button down ... once u released it it stops... this is what i suggest u to use to avoid any other future coding problems in C2 same logic can be applied to on mouse button or touch... they all have same conditions

    on release condition well obviously ... when the button was pressed and is released the animation or events will trigger one time unless its a looping animation

    thats how far i can remember for the keyboard customization's and as being relative correct to ur problem.

    dont beat yourself to fast... its usually a pretty easy solution 99% of the time , and also 99% of the C2 coding problems are made by programmers or because we get hyped by the easy system of getting things done fast and so smooth with it that we dont double check it.. or we dont try understand it a bit further, since its a no programming required software we expect things to happen by themselves which most of time do... but we need to understand how to make those things make sense to the machine we are communicating with... i get it .. been there done that..

    hope it helped you out.... also try reading the manual its pretty easy to understand and a complex lecture also covers a lot more then keyboard using... will really help you out on some cool stuff that will ease ur work in future.. if u got time for it.

    extra tip if u dont have different conditions that has to happen on the same key... dont use nothing else but IS PRESSED DOWN same for mouse/touch relative to movement other conditions relative to pressing are a dud and will only confuse u (for clicking u can easy use TAP touch object applies to browsers and mobiles directly i never used mouse rarely when i really need some extra thing from ti that touch doesn't had it before... but now there is no need for mouse object anymore)

    C2 basic friends conditions that i prefer and recommend because they never let me down - touched - on TAP /for objects clicking simulations /is in touch - is down - for dragging motions or movements with keyboard or any other thing... i strongly dont suggest using on release... 80% of the time will not trigger and if it does will trigger wrong cause u might release and click again to soon

    there is one maybe exception for the -release- condition one where u dont use it for fast interaction cause - on release- condition will have a tactile delay triggered by human response which means the delay between touching and releasing the button... most people want stuff to happen when they click it not when they release... it makes perfect logic.. we dont want to wait... we need that speed lol ......... monkey brain i guess not developed.

    remember.. is pressed down.. usually is used for moving objects... for playing animation to work with it u have to get more specifics in sub events if needed

  • Why is your character direction set to RIGHT when pressing left?

    The animation mirrors so it is the same thing as saying LEFT walking animation.

    well that is because i guess u made the events on release button or once pressed on one of them, is a basic mismatch that most people dont see as how things work in c2... C2 takes every line of code as you lay it down in the event sheet. so if u tell it play animation left for example when A is down its going to do so... as for playing an animation when was pressed... thats a totally different logic... and has a different meaning if u try to understand it a bit more then a quick glance... try swapping from pressed.... to IS PRESSED or IS DOWN that will fix it however... the last key u press is going to be the last that will be triggered so if u press AD and the delay between them is by 000000000. pico something the very next one pressed down will be the one animating ur character.

    for better ease of understanding...

    Was pressed condition triggers one time if the button was sometime pressed and the events or actions are not in play - sometimes they might even overwrite each other but wont be a big glitch or something visible

    IS PRESSED condition triggers if u keep pressed the button down ... once u released it it stops... this is what i suggest u to use to avoid any other future coding problems in C2 same logic can be applied to on mouse button or touch... they all have same conditions

    on release condition well obviously ... when the button was pressed and is released the animation or events will trigger one time unless its a looping animation

    thats how far i can remember for the keyboard customization's and as being relative correct to ur problem.

    dont beat yourself to fast... its usually a pretty easy solution 99% of the time , and also 99% of the C2 coding problems are made by programmers or because we get hyped by the easy system of getting things done fast and so smooth with it that we dont double check it.. or we dont try understand it a bit further, since its a no programming required software we expect things to happen by themselves which most of time do... but we need to understand how to make those things make sense to the machine we are communicating with... i get it .. been there done that..

    hope it helped you out.... also try reading the manual its pretty easy to understand and a complex lecture also covers a lot more then keyboard using... will really help you out on some cool stuff that will ease ur work in future.. if u got time for it.

    extra tip if u dont have different conditions that has to happen on the same key... dont use nothing else but IS PRESSED DOWN same for mouse/touch relative to movement other conditions relative to pressing are a dud and will only confuse u (for clicking u can easy use TAP touch object applies to browsers and mobiles directly i never used mouse rarely when i really need some extra thing from ti that touch doesn't had it before... but now there is no need for mouse object anymore)

    C2 basic friends conditions that i prefer and recommend because they never let me down - touched - on TAP /for objects clicking simulations /is in touch - is down - for dragging motions or movements with keyboard or any other thing... i strongly dont suggest using on release... 80% of the time will not trigger and if it does will trigger wrong cause u might release and click again to soon

    there is one maybe exception for the -release- condition one where u dont use it for fast interaction cause - on release- condition will have a tactile delay triggered by human response which means the delay between touching and releasing the button... most people want stuff to happen when they click it not when they release... it makes perfect logic.. we dont want to wait... we need that speed lol ......... monkey brain i guess not developed.

    remember.. is pressed down.. usually is used for moving objects... for playing animation to work with it u have to get more specifics in sub events if needed

    Well, that does not work...I need to find a way that when I press two buttons only the last one takes effects. Tap touch will not work with my type of game.

  • BUMP:

    So I think that I need to make it so that when A (Left) is pressed, D(Right) cannot be pressed? Anyone knows how to disable a key while another key is going on perhaps?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • BUMP:

    So I think that I need to make it so that when A (Left) is pressed, D(Right) cannot be pressed? Anyone knows how to disable a key while another key is going on perhaps?

    Please don't bump your own post after only 3 hours.

    The users who generally try to help come from varying timezones, so a little patience is necessary.

    It is acceptable to bump if you haven't had a response after a day or so.

  • BUMP:

    So I think that I need to make it so that when A (Left) is pressed, D(Right) cannot be pressed? Anyone knows how to disable a key while another key is going on perhaps?

    Something like this should work for that:

    On A pressed

    D is not down

    set direction to left

    on D pressed

    A is not down

    set direction to right

  • No need to bump without the capx. If the above post doesn't work then you'll need to post some cut down capx so we can test it if you want an actual fix.

  • > BUMP:

    > So I think that I need to make it so that when A (Left) is pressed, D(Right) cannot be pressed? Anyone knows how to disable a key while another key is going on perhaps?

    >

    Please don't bump your own post after only 3 hours.

    The users who generally try to help come from varying timezones, so a little patience is necessary.

    It is acceptable to bump if you haven't had a response after a day or so.

    Sorry about that! Won't happen again!

    > BUMP:

    > So I think that I need to make it so that when A (Left) is pressed, D(Right) cannot be pressed? Anyone knows how to disable a key while another key is going on perhaps?

    >

    Something like this should work for that:

    On A pressed

    D is not down

    > set direction to left

    on D pressed

    A is not down

    > set direction to right

    Did not work...haha I need to find a way for the computer to think of pressing A and D as they're next to each other, but it seems to process whichever is placed first.

  • This is the easiest thing to sort out, something must be wrong with the logic. Post a link to the capx or a cut down version of the game with just the player movements and someone can fix it easily. Also you haven't said what you expect to happen when A and D are pressed at the same time.

  • >

    > > BUMP:

    > > So I think that I need to make it so that when A (Left) is pressed, D(Right) cannot be pressed? Anyone knows how to disable a key while another key is going on perhaps?

    > >

    >

    > Something like this should work for that:

    >

    > On A pressed

    > D is not down

    > > set direction to left

    >

    > on D pressed

    > A is not down

    > > set direction to right

    >

    Did not work...haha I need to find a way for the computer to think of pressing A and D as they're next to each other, but it seems to process whichever is placed first.

    You did see the difference between "on pressed" and "is down" in my example?

    Should work just fine that way..

    But if you keep having issues, please share your capx, for this should be pretty easy to get right..

  • Good news everyone! I finally fixed it! Thanks for the help! I ended up doing something entirely different though!

  • on A and D pressed u have set character direction to Right why is that? oh good that u fixed it... sorry didn't seen 2nd page...

    however the previews picture u uploaded the character was playing the right animation for both buttons cause... well u set it that way..

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