Learn You A Game Jam - Day 4


Ok, had a some progress and notes in a log but my machine rebooted on me.  I was working out the structure of the guildies and the characters in general.

Ok for NPCs (Enemies, Guildies, and Neutrals) the relationship between the Character and the Item will determine their behavior.  I think of it like the bomb defusal game (Keep Talking and Nobody Explodes).  The Character has all the current information, as well as access to the buttons and dials to interact with the game.  The Item is a bunch of static instructions and it tells The Character what to do based on the information that the The Character provides.

Item to Character: First of all, put on these clothes.
Character to Game: THIS IS ME NOW!
Item to Character: These clothes come with IDLE and ACTION, keep it in mind.

Item to Character: Look out for THIS.  Otherwise IDLE.
Character to Game: Is THIS happening? (Circle one: Yes / No)  I'll just be over here, IDLEing.

When Game says Yes:
Character to Item: THIS is happening.
Item to Character: Ok, do ACTION and then IDLE again.
Character to Game: I'm doing ACTION, my Sword told me to!

SIGNALS!

The Character has a StatSheet, Sensors, a Body, and a base set of behaviors including ones modified by stats like alignment and an Item like default visual/action plan if it doesn't have an item.  For instance, a Guildie (allied NPC) has a basic behavior of Recruit if it doesn't have an item.

The Item has the CharacterSprites (AnimatedSprite2D), Animation States to give the holder, instructions on what to look for and when/how to use the Actions.

Adding the damage animation meant I had two animations going simultaneously.  So I made CharacterAnimation as the State Machine that should be one animation playing at a time, and an EffectsAnimation that can overlap the Character Animation and even itself.

I'm not going to try to venture into AnimationTree yet, I'm learning so much already and I feel like coding logic can get me where I need for now.

I officially have added combat!  Its kill or be killed. Although multiple Slimes are taking damage when only one should be and killing the player crashes the game because the slimes are trying to follow the now released player.  But both the MainTank and the Slime both can attack the other and will die when they take too much damage.  AKA Combat!

Ok, I needed to make my StatSheets local to scene, so that changes to one as a resource do not effect another.  It didn't matter on MT vs Slimes because they were stored in different scenes, but the slimes were effecting each others stat sheets.  I will make all StatSheets local to scene, which should allow me to update them independently.

The Slimes now take damage on their own, and the kill the player.


I then had to fix up some things with how the player would move after it was dead, and created an "accepting input" and "is alive" flag and a character_state string that updates at the beginning of the appropriate animation.  Right now its just parroting the name of the character animation playing, but I expect this will be a useful thing to have on the stat sheet... which will likely needs some organizing into stats like "Strength" and behavior info like "accepting input" soon.

Get Guildies

Leave a comment

Log in with itch.io to leave a comment.