Jump to content
  • Advertisement
Sign in to follow this  
ElectricBlah

detecting releasing a key in allegro

This topic is 4234 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

suup. hey i'm really new to game programming, and for now just messing around with allegro, attempting to slowly develope a platforming game. i've run into tons of problems, but it's feels awesome as soon as i get passed them. anyway, in my game i have it so while you're pressing the left or right arrow keys, the character moves left and right respectively, scrolling through his animation as he moves. when the user lets go of the left or right arrow, though, i need to change the character's sprite back to his idle pose. i tried a bunch of ways to do this, but none of them ended up working out. is there anyway to test if a user lets go of a button in allegro? if so, then i could just detect when the user lets go of the button and if they do change his animation to the idle pose. here's the button detection code in my game: while ( !key[KEY_ESC] ){ movePlayer(); } return 0; } void movePlayer(){ if ( key[KEY_LEFT]) Stevie.walk( LEFT, buffer, screen); else if( key[KEY_RIGHT]) Stevie.walk( RIGHT, buffer, screen); } i've been working off of the code in the animation 2 section of http://www.cppgameprogramming.com/cgi/nav.cgi?page=intro, so if it looks familiar in any way, that's why! (love that site :D.)

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!