Two-key - diagonal walk

Get help using Construct 2

Post » Tue Apr 23, 2013 3:25 pm

hi. I still cant solve one problem - im making kind of Zelda style game, but with 8direction behavior. Hero is independet on mouse. Animations of basic movements like walking down, wolking up, left, right, are ok, but i still cant set animations for diagonal walk ( example of event: Down arrow is down + Left arrow is down) = set animation of run.
But they are not moving. Loop is on, speed is 5. Do you know where the problem is??



B
3
Posts: 7
Reputation: 189

Post » Thu Jun 06, 2013 9:52 pm

I was wondering the same thing. I know a work-around to setting animations based upon the angle of the current player, but there is always a lag in animation change when changing directions, which is entirely unacceptable. The animation changes are instantaneous when they are mapped to keys, but when you try to do what you described it doesn't work.
B
6
S
1
Posts: 62
Reputation: 532

Post » Thu Jun 06, 2013 9:53 pm

I can link you to an explanation of the workaround if you want, or I will post here when I figure out how to do this without lag.
B
6
S
1
Posts: 62
Reputation: 532

Post » Thu Jun 06, 2013 11:40 pm

Try something like:

Up key down
-> Left key down: Set animation to up-left
-> Else and Right key down: Set animation to up-right
-> Else: Set animation to up

Where the -> are sub-events. Then you do the same for all 4 directions.
B
52
S
10
G
6
Posts: 133
Reputation: 8,715

Post » Thu Jun 06, 2013 11:54 pm

siks: That does the same thing as my other potential solution; it triggers the first frame of the up-left animation, but the animation doesn't actually play.
B
6
S
1
Posts: 62
Reputation: 532

Post » Fri Jun 07, 2013 12:07 am

Hm,I think I know what's going on.

C2 is reading every frame that the Up and Left (for example) are being pressed, so it's setting the animation every frame!

Try this:

Up key is down
-> Left key is pressed: Set animation to up-left
-> Right key is pressed: Set animation to up-right
-> Else: Set animation to up

If it doesn't work, I may have another solution, but it's more complex... I hope this one works =P
B
52
S
10
G
6
Posts: 133
Reputation: 8,715

Post » Fri Jun 07, 2013 12:23 am

" there is always a lag in animation change when changing directions, which is entirely unacceptable."
I think I know what you mean now.

https://dl.dropboxusercontent.com/u/78545260/SurvHorrPrototipo1.21/index.html

If I'm right, I had the same problem in this demo.siks2013-06-07 00:25:19
B
52
S
10
G
6
Posts: 133
Reputation: 8,715

Post » Fri Jun 07, 2013 12:36 am

That doesn't work either, and "Else" isn't valid when used in that event chain.
B
6
S
1
Posts: 62
Reputation: 532

Post » Fri Jun 07, 2013 12:39 am

Else can't work on triggers, use is down conditions for the keys
https://www.scirra.com/forum/viewtopic.php?t=152506

And that is why you shall respect the bug reports guidelines, not only giving a capx is making the bug reproductible in one click in a situation they can work with (less time wasted trying to reproduce vague instructions) but also it helps filtering false positives.

Game design is all about decomposing the core of your game so it becomes simple instructions.
B
42
S
17
G
16
Posts: 2,094
Reputation: 15,355

Post » Fri Jun 07, 2013 12:52 am

Here is the test level link:

https://dl.dropboxusercontent.com/u/172450407/New%20project/index.html

I have found 3 ways to make the Up-Left (W+A) animation to trigger, but it stays stuck in the first frame. I cannot, for the life of me, figure out how to get it to play from keyboard triggers.

Here are the movement events as they sit now:

B
6
S
1
Posts: 62
Reputation: 532

Next

Return to How do I....?

Who is online

Users browsing this forum: chcteacher, Televangelist and 26 guests