Animation for diagonal shooting in platformer not working...

Get help using Construct 2

Post » Sun Jul 09, 2017 5:39 pm

Hello, world!
I am working at a simple Metroid-style game, but I got stuck at the diagonal shooting animation. When pressing the "W" and "D" buttons (the right-up combination), the sprite changes, but it doesn't move. What should I do?

Here are the events and actions (because I can't put an image unless it's on a site or something):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Player, On platform moved - Set animation speed to 15
Player, Platform is NOT moving - Weapon, Set animation speed to 0
- Weapon, Set animation frame to 0

Player, NOT mirrored - Weapon, set animation to Right (play from beginning)
Player, mirrored - Weapon, set animation to Left (play from beginning)

Keyboard, W is down
|- Player, NOT mirrored - Weapon, set animaton to UpR (play from beginning)
| |- Keyboard, D is down - Weapon, set animation ro DiagonalUpR (play from beginning)
|
|- Player, mirrored - Weapon, set animaton to UpL (play from beginning)
| |- Keyboard, A is down - Weapon, set animation to DiagonalUpL (play from beginning)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note: The "Right" and "Left" animations are ANIMATED, they stop when Player doesn't move, the Weapon being attached to it.
The "UpR" and "UpL" animations are NOT ANIMATED, they are used when the W key is pressed and Player doesn't move.

I hope the event sheet is intelligible.


Thank you very much! :D
B
2
Posts: 3
Reputation: 156

Post » Sun Jul 09, 2017 7:12 pm

When you say 'it doesnt move' are you talking about the platform sprite does not move or the animation does not play?
Are you saying it is working as expected when pressing W and A?
B
45
S
15
G
73
Posts: 2,006
Reputation: 43,394

Post » Mon Jul 10, 2017 9:00 am

The sprite doesn't play, sorry for confusion. And it also doesn't play when the other keys (W and A, as you said) are pressed
B
2
Posts: 3
Reputation: 156

Post » Mon Jul 10, 2017 9:19 am

I think I've seen this before. As a logical guess, you have the when W is down checks but they are overridden by the general checks for mirrored/not mirrored, so its trying to play left/right animation constantly as well as the up and diagonal animations, they are basically true at the same time. You need to filter out the general checks for left right with when W is not down.
B
45
S
15
G
73
Posts: 2,006
Reputation: 43,394

Post » Tue Jul 11, 2017 9:22 am

Hello, World!
After some tries and lots of translates (because I don't know verry well english and I am new to Construct 2 :p ), your advice helped me! Thank you very much.

For those who have the same problem here is how I did it (my way may differ from what you thought):
I filtered out the general conditions. For example:
First, if the player has the variable "diretion" equal to "right"...
if I press the W and D keys, the sprite changes to the "diagonal right up" sprite
if I press the D, but NOT the W key, the sprite changes to the "walking right" sprite
if I press the W, but NOT the D key, the sprite changes to the "facing up right" sprite (a static one, facing right, he looks up)
if neither W or D keys are pressed, the sprite changes to the "standing right" sprite

If the player has the variable "direction" equal to "left", we do the same thing, but with A insead of D.

I don't know if this is the solution you thought, plinkie, but your advice worked.

Thank you very much! :)
B
2
Posts: 3
Reputation: 156

Post » Tue Jul 11, 2017 9:29 am

Yes, that would be an identical solution.
Last edited by plinkie on Tue Jul 11, 2017 9:57 am, edited 2 times in total.
B
45
S
15
G
73
Posts: 2,006
Reputation: 43,394


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests