How do I Fix my Character's Movement?

Get help using Construct 2

Post » Mon Dec 21, 2015 3:27 am

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
B
6
S
1
Posts: 39
Reputation: 454

Post » Mon Dec 21, 2015 4:03 am

Why is your character direction set to RIGHT when pressing left?
B
44
S
14
G
60
Posts: 1,795
Reputation: 36,388

Post » Mon Dec 21, 2015 4:05 am

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.. :D


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
B
70
S
20
G
67
Posts: 1,311
Reputation: 42,284

Post » Mon Dec 21, 2015 4:43 am

plinkie wrote: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.

gamecorpstudio wrote: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.. :D


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.
B
6
S
1
Posts: 39
Reputation: 454

Post » Mon Dec 21, 2015 7:55 am

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?
B
6
S
1
Posts: 39
Reputation: 454

Post » Mon Dec 21, 2015 8:32 am

Nahuos wrote: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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
129
S
29
G
77
Posts: 5,196
Reputation: 54,299

Post » Mon Dec 21, 2015 10:06 am

Nahuos wrote: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
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Dec 21, 2015 3:00 pm

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.
B
44
S
14
G
60
Posts: 1,795
Reputation: 36,388

Post » Mon Dec 21, 2015 5:50 pm

zenox98 wrote:
Nahuos wrote: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!

LittleStain wrote:
Nahuos wrote: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.
B
6
S
1
Posts: 39
Reputation: 454

Post » Mon Dec 21, 2015 6:11 pm

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.
B
44
S
14
G
60
Posts: 1,795
Reputation: 36,388

Next

Return to How do I....?

Who is online

Users browsing this forum: MuchaDev, tetuan, tikuna and 4 guests