How do I can set the animation of the character correctly

Get help using Construct 2

Post » Thu Apr 16, 2015 8:22 pm

Greetings.
I have the following problem.
I created a character that can move in four directions, but when preciono more than one key at the same time address, animations stop playing correctly, for example:

arrow left + arrow up = the character moves but the animation is the first motion picture to the left.

then I show a screenshot of my events
Thank you very much for your help


Image
B
3
S
1
Posts: 8
Reputation: 593

Post » Thu Apr 16, 2015 8:55 pm

You can add the inverse keys as well.

For instant:
Left arrow is down
X Up arrow is down
X Down arrow is down
X Right arrow is down.

Then you make one for each possibility you need.

Left arrow is down
Up arrow is down
X Down arrow is down
X Right arrow is down

etc.
B
44
S
11
G
2
Posts: 1,181
Reputation: 6,816

Post » Fri Apr 17, 2015 12:18 pm

Thank you very much for your reply.
Excuse me but I really did not understand it refers to.
Could you elaborate a little more please?
B
3
S
1
Posts: 8
Reputation: 593

Post » Fri Apr 17, 2015 12:25 pm

If left-arrow-key is down and up-arrow-key is down, there are two events that are both executed, because the conditions are true.

so every tick the computer is told to start animation for left and animation for up, in effect showing the first frame of animation every tick.

To solve this you have to make sure only one of the two events is true.
This can be done by adding extra conditions like the ones @nimos100 shows in his post.
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 » Fri Apr 17, 2015 12:46 pm

This programming would result in nested if statements?
for example

if (LEFT_ARROW is down)
{
if (up_arrow is down)
{
//move player to up
}
etc ....
}
B
3
S
1
Posts: 8
Reputation: 593

Post » Fri Apr 17, 2015 12:55 pm

I'm not familiar with nested anythings, but you could try using else statements, if that suits your need.
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 » Sat Apr 18, 2015 12:57 am

Arkanainster wrote:Thank you very much for your reply.
Excuse me but I really did not understand it refers to.
Could you elaborate a little more please?


If you right click for instant "On left arrow pressed" you can inverse it. Meaning as long as "Left arrow is not pressed" it will be true.

Since you need to test vs several key press at the same time, there are more options than simply to test vs one.

So you have to add a "On left arrow pressed" and "On up arrow pressed, if you would like you character to jump to the left for instant. Like so:
Code: Select all
Left arrow is down
Up arrow is down


Since you also have one for moving left:
Code: Select all
Left arrow is down


Both of these will trigger if you for instant Jump to the left. Because moving left will trigger true whenever left button is pressed. So to make sure that it doesn't do that you can do like this:
Code: Select all
Left arrow is down
X Up arrow is down (Inversed)

So as long as left arrow is down and up arrow is not, then you character will move left. So you have to do that for all the possible ways you want you character to move.
B
44
S
11
G
2
Posts: 1,181
Reputation: 6,816

Post » Wed Apr 29, 2015 5:30 pm

ok, but,which event are X Up arrow is down (Inverted) in C2 ??
B
3
S
1
Posts: 8
Reputation: 593

Post » Wed Apr 29, 2015 5:40 pm

Right click...
Image
Image
B
62
S
23
G
7
Posts: 1,470
Reputation: 10,731

Post » Wed Apr 29, 2015 5:44 pm

thanks
B
3
S
1
Posts: 8
Reputation: 593


Return to How do I....?

Who is online

Users browsing this forum: TheSynan and 10 guests