Key Pressed Problem

This forum is currently in read-only mode.
From the Asset Store
Random Maze Generator with Door & Key System - tutorial capx
  • Why doesn't this work?

    I want him to crouch when the down key is pressed and stand up when the key is released, but when the key is released he stays crouching? :S

    <img src="" border="0" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the way you have it arranged with the key released as a sub-event of the key pressed, the program is waiting for both conditions to be true, i.e. when down arrow is pressed and it is released at the same time, the sprite will switch to the Default animation. Try making the second event a completely separate one rather than a sub-event and see if it works properly.

  • Yeah man! That was the problem! Thanks a lot! :D

  • Now I have another problem, when he crouches, he falls a bit and hits the floor because he isn't as tall as the standing sprite.

    I tried making the image the same size as the standing sprite and just deleted the top half so it was see through, then I got the problem of the collision mask being taller than the sprite :S

    Is there a way to stop the falling or resize the collision mask?

    I also did a stabbing animation that is twice as wide, the sprite moves backwards, I just want the sword to come out infront of the sprite that stays standing in the same position?

  • Sounds like you just need to adjust the Hotspot for the crouching animation. It's one of the buttons near the bottom on the left-hand side when you've got the sprite editor open. The hotspot is basically the point around which the sprite pivots, so you'll just need to align the hotspots in such a way that the sprite crouches down.

  • Thanks a lot man! You're a big help! :D

  • Ok, so I'm making a Ninja Gaiden engine, as you might have guessed by the sprite on the picture I posted xD

    I had him stabbing fine but I must have done something accidentally and he doesn't stab anymore D:

    I also want him to stick to walks and climb up and down, but one problem at a time ey...

    Could anybody tell me why he isn't stabbing anymore?

  • Gosh, that one threw me for a bit of a loop <img src="smileys/smiley36.gif" border="0" align="middle" />

    I haven't had much dealings with Construct's platform system unfortunately, but I've narrowed it down to being some sort of problem with when the sprite is standing on a platform. The sprite will stab as needed when he's in the air, however when his feet are on the ground something is apparently overriding his stab animation.

    What I ended up doing is removing the "Stopped" tag from the Default animation of the sprite. That seems to fix the stab problem but he will no longer automatically revert to his standing animation when he isn't moving. I then included the event Sprite is on ground + Sprite is not moving + Animation "walking" is playing --> Set animation to "Default"

    That seems to make it work for the most part.

  • haha, thanks once again! i'll follow your steps later :)


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