kpenrose92
Member
Hey everyone. I'm just looking over the code I've been working on for a top-down action-adventure project and wondering if I'm organizing everything in the player object right. The more actions I give to the player, the more complicated my step code has become. Now, whenever I want to create a new action, I have to navigate a confusing web of code to implement it.
I'm curious to how other people manage to organize their player's step code and keep it legible and understandable.
My player object runs like a state machine, with a variable called "state". States are broad changes made to the player's behavior, like pausing him for dialogue, attacking, or dying and respawning.
Inside each state are substates managed in a variable called "phase". This controls the stages of various attacks, powerups, and move states such as swimming, falling into pits, etc.
Anyway, how do you keep your player object organized? For example, do you use lots of scripts for small blocks of code, or do you tend to use scripts only when needed? Screenshots and code chunks would be awesome to read. Thanks!
I'm curious to how other people manage to organize their player's step code and keep it legible and understandable.
My player object runs like a state machine, with a variable called "state". States are broad changes made to the player's behavior, like pausing him for dialogue, attacking, or dying and respawning.
Inside each state are substates managed in a variable called "phase". This controls the stages of various attacks, powerups, and move states such as swimming, falling into pits, etc.
Anyway, how do you keep your player object organized? For example, do you use lots of scripts for small blocks of code, or do you tend to use scripts only when needed? Screenshots and code chunks would be awesome to read. Thanks!