GML Working with enemies & parents & childs

JeanSwamp

Member
Hello,

I'm looking for a design advice regarding enemies for platformers. Currently I'm making a basic code for a single enemy which is obj_Enemy.

My plan was to make a state machine going, with different states and all the basics working, from jumping, to climb ladders, attack, shoot, etc.

If I have this only entity working, could then make a new object enemy, make it a child, assisng a different sprite and deciding which states I want them to have? Like this one I want it to be an archer so just activate normal state and shoot state... or this other one I want normal state jumping and ladder.

Is this a posible way to do it? Also, for example in order to swap sprites, I need to replace each sprite reference to the one I currently need in the child code, overwritting the parent, right?

Would appreciate some tips before I carry on. Otherwise I ll leave out the state machine and do each enemy individually.

Thanks!
 
Top