retrodude
Sure. First I want to mention though - this is not the only way to make RPGs! This is merely the best way I've come up with for the games I want to make. It allows me the flexibility and control to make super mario rpg type battles as well as simpler old school final fantasy type stuff.
All hero and enemy sprites are put in a family called units. I then create and pair a 'base' sprite instance to each unit instance by storing uids of both as variables for picking purposes. The base sprite does all of the controlling of the units through variables that define the unit's behavior and abilities, such as base.type, base.team and base.command. In a way, the base acts like a family for all units. I don't just code for the units family for various reasons such as I find it simpler to code the movement of the base object itself moving on the x and virtual z planes, and using a variable for the y (the height the unit is off the ground/the y distance between the unit and its shadow). Technically this could be done anyway coding the unit rather than the base, but since there are times where I can code the base to do stuff without needing to pick the unit at all, I prefer it this way.
By using this method, I can have any unit act like any other unit simply by setting a variable on the base sprite. It's also easy to make different units use each other's abilities if I want, as long as that unit has the requirements (like animations) for the code to use the ability.
I isolate code as much as possible in a 'code tree' to minimize code interfering with other code. Extremely oversimplified example:
If global mode = paused, store all menu code as subevents here
If global mode = battle
- if var battlemode = intro, store code for characters running on screen at the start of battle here
- if var battlemode = advance turn, advance turn markers, pick a base/unit when it's their turn, set base.turn to 1, set battlemode to action
- if var battlemode = action
- - if base.turn = 1
- - - if base.type = Renae
- - - - if base.command = "attack"
- - - - - if base.step = 0 (the step var is not necessary in this example, but used quite often in many of the abilities to keep segments of the abilities and cinemas from interfering with each other), run forward, upon reaching target position, play attack anim
- - - - - - if anim attack playing and Renae's animation frame is above or equal to 5, run function 'hit' with perameter base.targetuid, create damage numbers, hit fx, etc
- - - - - - - on attack anim completed, run back, on reached target position, set base.turn to 0, set var battlemode to advance turn, set turnmarker.x to left side of screen
- if var battlemode = victory
If var mode = cinema
- If var scene = first battle
- - if step = 0, walk in from screen left
I hope that helps!