animations and keydown

Blitz3D Forums/Blitz3D Programming/animations and keydown

I have been coding in blitz for sometime now and my games are getting more ambitious.
The problem I have is that the players have multiple animation sequences which are becoming tricky to manipulate in the code. I have checked the forums but cannot get what I need.

question1: Whats the best way to handle multiple animations with keypresses. (Without interferring with each other). Case Select ?? or other. Examples would be cool.

question2: Is there a way to detect if NO keys are pressed. sort of keydown (nul).

question3: What about key release.

Like I said I can get very near but the amount of code and combinations seems way too much and I am sure there must be a simpler way.


Any examples please.

i have a variable caled PlayerMode

0=stand still
1=walk
2=jump upp'
3=faal down
4=duck
5=die

iam sticking to the sellect statement.

Apologies if you have already seen this but it may help :
http://www.blitzbasic.com/codearcs/codearcs.php?code=660

Thanks for that. I am now using something similar with a switch to ensure that the state is maintained until the sequence has finished. May be crude but it works.

deleted post( opps pressed the enter too many times look below)

Q2 answer: yes simply use the not operator in front of the keydown:
 if not keydown(205) 

or use else inside the if statement:
if keydown(205)
   print"you are pressing me too hard dude let go!"
else
   print"dude im itching can u press the right key?"
endif


Q3 answer: try something like this (sorry if my code is messy)

 if keydown(205)
   ;blah!
   key_pressed=1
endif

if key_pressed=1 then
   print"you released the right key"
   key_pressed=0
endif