More update!
I've been working full time on the battle system, but almost only on the technical side of it. Algorithms, gameplay loop and logic, etc. so last weekend I decided to bring more life to it by working on the animation system.
Just like the latest versions, the animation system will be based on RPGXP's battle animation system.
The difference here is that you create the animations in the editor but the actual animation you see in-game is not a battle animation.
And this is the part where I go deeper into technical details.
[WARNING-Technical stuff here!!!]
The Sprite_Battler class (if the battler is an actor) will update its source rect (sprite.src_rect) based on the data found in a battle animation (cell_data).
For this to work properly, the battler's spritesheet must have the exact same format as the animation spritesheet. The advantage here is that the battler's spritesheet will overwrite the animation spritesheet, allowing multiple actors to share the exact same animations but using their own graphics.
As of now, there is a limitation with this system.
Normally, RPGXP's animations can have up to 16 sprites (or cells) shown per frames. In this case, battlers animations only uses the first cell (cell[0]) of each animation frames to animate the battler. This is actually part of the design as I don't want it to be the exact same system. Eventually, battler animations and other animations (or special effects as I like to call them) will be 2 different things.
This system has some features that allows the user to specify how the animation will be played. In the Game_Battler class, the start_animation method can use the following arguments:
- id : [Integer] ID of the animation to play
- loop_max : [Integer] how many time the animation will loop (-1 is infinite loop, 0 is play once, 1+ is play more than once)
- loop_range : [Array] at which frame the loop starts (index 0) and at which frame the loop ends (index 1).
- start_frame: [Integer] at which frame the animation starts
- timescale : [Integer] At which rate the animation will be updated (1 = every frames, 5 = every 5 frames, and so on)
The system currently supports a few basic poses such as the idle, dead, weak, "ready" and victory poses.
The next step is to implement custom poses for battle commands, items, spells, etc.
Later on, I will make it so certain states, items, spells, etc. can overwrite a specific animation. For example, poison could overwrite the idle animation too have the weak animation playing there instead.
It's a very complicated system and the worst part is trying to make is user friendly and compatible with RPGXP. But I'm getting there, slowly but surely!
- Dargor