Computer Science Canada RPG Battle Animation |
Author: | Avarita [ Thu Feb 02, 2006 9:23 am ] | ||
Post subject: | RPG Battle Animation | ||
Hi. So I'm making this RPG thing and I got all the battle stuff worked out already but I need some help on the animation. My battle system is a turn based system, and the player can choose from a list of attacks.The enemy AI also has a preset list of attacks to choose from. I want that when the attack executes, before the damage is shown, the animation pops up. I want to have unique animations for each one too. Here's my pseudocode for the battle part of the game:
I want to include the animation in between calculate damage and deal damage, so if the attack misses, then the sound effects will be somewhat different, like a "missed attack" sound effect. Each of my attacks are stored in an procedure. The procedures include the element of the attacks, the code to calculate the damage and so on. Because each attack animation will be different, should I have each attack procedure return an animation value which will be passed onto another procedure to select the appropriate animation for that attack? Or is there another more efficient way of doing this. Another problem I have is the animations themselves. I want to animate something but I can't call clear screen or the background will be cleared as well. Is there a way to store the background temporarily and repaint it each time I call clear screen in my animation? Or again, is there another more efficient way of doing it? Ty for the help. |
Author: | Delos [ Thu Feb 02, 2006 11:49 am ] | ||
Post subject: | |||
Linearly programming an RPG? (Albeit, with a bit of procedurization thrown in too). Sorry to break it to you, but unless you step it up a notch and start incorporating some system of object-orientation you'll keep running to into problems like these. The good news, however, is that you obviously have the frame of mind and ideas to figure this stuff out. To start, here are the answers to your questions: Avarita wrote: Because each attack animation will be different, should I have each attack procedure return an animation value which will be passed onto another procedure to select the appropriate animation for that attack? Or is there another more efficient way of doing this. Procedures technically don't return values, functions do . But that's besides the point. This is a feasible idea - you would likely used this return value to select a pointer of sorts from an array, and thus choose your animation. Keep this point in mind, I'll come back to it later. Avarita wrote: Is there a way to store the background temporarily and repaint it each time I call clear screen in my animation? Or again, is there another more efficient way of doing it? I'll throw a couple of commands in here, tell us which ones you know:
Chances are you're looking for View.Update, though it's little brother View.UpdateArea is largely ignored though likely far more useful in many cases (such as this one). Now for a couple of pointers: From your pseudocode I'm guessing you don't know too much about records and types. However, from your problem description, I'd wager you have the concepts down. Read up the Tuts on these topics in particular (whether or not you're proficient in them. They're a good way to gauge yourself) (also, the Walkthrough provides a complete list): - arrays (single dim, multi dim, flexy) - records and types - procedures, functions, processes (stay *away* from the latter) - modules - Classes (check out Cervantes 3-part Tut to them - good stuff that) Classes in particular will be the path you'll eventually be running down. You'll see what I mean. Post up any more q's you have, and I hope to see a final product (or at least a beta) sometime. |
Author: | redrenagade [ Thu Feb 02, 2006 4:37 pm ] |
Post subject: | Nice Work |
Man, you guys are making amazing programs compared to me. And I made the best program in my class too. Keep up the good work |
Author: | Avarita [ Sat Feb 04, 2006 5:01 pm ] | ||
Post subject: | |||
I'm not linearly making an rpg... I'm using objects and classes. And I'm quite good at records and types, well, they aren't hard to begin with. So I do not need the walkthroughs you have referred. Thx anyway. So I should have an array of animations (maybe an array pf procedures?) and then just pick from it? For the actual animation part, I know all the commands you gave me. Maybe I should describe the problem more in depth: Let's say I have the background painted from a previous iteration of the battle loop. Now the player choose an attack and the animation starts. This is how I picture I would integrate this in the loop.
Wait, I just figured out how to do it whilst typing pseudocode! At first I wondered how to clear the part where the animation took place, but now I just thought of repainting the entire background. Thx... I guess? :p |