Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / ignoring spacekey for inkey=0?

Author
Message
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 1st Feb 2006 06:28
yo!
i am trying to make it so my game can still play the attack animation. becuase currently i have a spot that says if no keys are pressed the stop the object and have him stand idle. I want it so after you press the spacekey then it plays the attack animation but this is impossible with my other code becuase no buttons are being pressed when the attack animation would be played. heres my code:
basicaly what im asking is, is it possible to give the spacekey immunity to my "if no keys are pressed then go idle" command?

thanks:



~snow

Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 1st Feb 2006 13:23 Edited at: 1st Feb 2006 13:24
You tried this ?



I not fairly sure does that work...



Goto the http://forum.thegamecreators.com/?m=forum_view&t=68828&b=8 to see latest news on my game..
Acolyte Entertainment
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location: Oregon, US
Posted: 1st Feb 2006 15:49
yes. but my problem is, when its reading that and i say



that is saying if space or W isnt pressed then go idle. but my animaition still wont play becuase spacekey is not being pressed when the animation is supposed to play.

thanks JaRsE,
~snow

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 1st Feb 2006 18:50 Edited at: 1st Feb 2006 18:53
snow, if i'm understanding correctly, you hit the spacebar to start the attack sequence and want to complete the sequence whether or not the spacebar is still being pressed, right? it's something i've contended with recently and what i did was once the Attack sequence is initiated (using Control Key) i turned on a flag, like this: "AttackFlag = 1" that stays true until the animation was complete. ie, "If NextAttackFrame > MaxAttackFrame then...". after the last frame is played i reset "AttackFlag = 0". then in the player input section of the code i used something like:

if keystate(29) = 1 or AttackFlag = 1

and, here's what i'm using for the complete 'attack' code. it includes handling the sound effect, and idle timer too

given:
'attackframe' = the last attack frame for the animation
'attack' = the attack flag like i mentioned above
'swingflag' = if sound playing(3) then swingflag = 1 else swingflag = 0 ... used to make sound work right.



hope this helps. good luck!

Athlon XP1800+, Windows XP+SP2, Soyo K7V Dragon+ MB, 1.5Gb 333 RAM, ATI Radeon 8700LT (128Mb)
Drivers and Updates Kept Current

Login to post a reply

Server time is: 2024-11-27 05:48:40
Your offset time is: 2024-11-27 05:48:40