TheAdamSmith / precursor

0 stars 0 forks source link

54 create state machine for different enemy behavior && 39 add ranged enemy #73

Closed mitchellkazin15 closed 2 months ago

mitchellkazin15 commented 2 months ago

Three major changes:

  1. Made state machine

    • Move enemy behavior into reusable components
    • Allows for complex behavior while avoiding complex code (nested if statements, etc)
    • To use add StateMachine Child node, add child states, link up initial states and transitions in the Editor
  2. Added Ranged enemy

    • Ranged enemies will follow player until they get in a range set in the editor
    • Then they transition to firing their gun, while continuing to move in the last direction they were traveling in
    • If they get out of range they will transition back to following
  3. Refactored stats and scaling to hopefully be more clear/consistent

    • Now each enemy type defines their own stat scalers and tier modifiers (used to be controlled by spawner)
    • Spawner then simply tells enemy what level they are and they set their own stats
    • Pattern now is more consistent, it goes: i. Any upgradable node, will need a stat_component, upgrade_compoenet, and stat_scaler ii. Upgrade component is responsible for setting base stats, and new stats based on levels iii. Stat component should almost always be initialized with zeroes for base stats and let upgrade node set them instead iv. Stat scaler defines how stats change each level, as well as what levels turn on/off specific functionality
    • Nodes that now follow this pattern include: players, enemies, guns, and abilities
mitchellkazin15 commented 2 months ago

Looks and runs good! Only comment is that the gunshot sound effect doesn't really fit with the little alien guys shooting fireballs. Probably want tickets for audio work for all the new stuff we add.

Agreed, I'll make that ticket now. Thanks for testing it!