Merry Christmas! And to a new and more desirable year to us all!
Text
Whatever game we are making, social interactions can enhance player immersion in them… even for one-sided interactions such as killing. By importing methods from our animated sprite class, we can quickly initialize a new non-player character (NPC) class, which can populate our once barren and lifeless environment (unless that is your intention).
For organization's sake, each set of sprites will be stored between action variables. If you recall, the get_images() method originates from past file sprite_object.py, which gets all files in a directory/folder.
Another set of things to initialize is your NPCs' characteristics. In the context of our Doom Pygame, an enemy would have a fixed amount of health, damage per attack, speed, etc.
The object handler will load our NPCs into our game-space once we import the same-named class into it.
Not only do we need to import the NPC class, but we also need to build a list to store each instance of them. While I only have sprites for one specific NPC, it would be optimal to store the parent NPC sprite path in a convenient referential variable for future convenience.
Now that the code for importing NPC data is complete, our next step is to store this set of data into our NPC list. And the next step after that is run an instance of the method that references our NPC class.
GUTS AND GLORY, LADS!
The first thing I look for in a 'living being' is movement. For now, this refers to idle actions.
When living beings (as we know for now) get hit, they react in attention or pain. Being shot with lethally designed projectiles warrants the latter. For this, we design a new method that checks if an NPC had been shot at recently.
Text
Text
Sound file source: https://pixabay.com/sound-effects/robot-taking-damage-98742/
Text
Text
Again, video with sound will be coming after I return home!