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.

AppGameKit Classic Chat / Spreading out actions across multiple frames instead of one

Author
Message
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 6th Feb 2012 11:57
I'm not sure how to phrase this, so I'll try to give an example.

My character has a whip. When the character uses the whip, he attacks with it in a circle, going in eight directions( N, NE, E, SE, S, SW, W, NW). However, instead of doing all eight directions at once - with like a FOR I=0 TO 7 LOOP - I would like a 1/2 second break in between, so I can illustrate each direction he's attacking in.

So, user attacks. It takes 4 seconds to attack total, giving me ample time to update the graphics and screen so the player can tell what's going on.

I'm using fake numbers of course, but the concept stands. What would be the best way of doing this? Instead of attacking all at once in the same frame, how can I extend said action across multiple frames?

Hi there. My name is Dug. I have just met you, and I love you.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 6th Feb 2012 12:34
Have it as an animation, and just play the animation.

My signature is NOT a moderator plaything! Stop changing it!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Feb 2012 12:43
I tend to set a "mode" that my characters are in. IE. mode 1 = can move, mode 2 = whipping stage 1, mode 3 = whipping stage 2 and so on.

Having an integer "mode" for each player and enemy makes it much quicker to run through what can and can't happen to them while in that mode. For example while whipping you don't want to be able to move so:
if player.mode=1
move_player()
else
do_whipping()
endif

I hope that makes sense!

anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 7th Feb 2012 05:28
Or, I could just do some magical trickery with AppGameKit to do the work for me



All I have to do now is call this within my FOR loop. Depending on the action (success or failure), it will loop through until the sound is done playing. Since my current project is old-school, I disabled the sprite animation to give the illusion of non-asyncronous audio playback

Hi there. My name is Dug. I have just met you, and I love you.

Login to post a reply

Server time is: 2024-11-23 01:11:44
Your offset time is: 2024-11-23 01:11:44