4 min read

Wings and Thighs: Piecing Together Enemy Behavior in The Meating

Coding enemies is a lot like cooking. Answering the question of "How should this enemy behave?" is similar to answering "What should this sandwich taste like?" For both questions, the secret is in the ingredients.

Coding enemies is a lot like cooking. Answering the question of "How should this enemy behave?" is similar to answering "What should this sandwich taste like?" For both questions, the secret is in the ingredients.

Fried Thwomp

Chicken Idle

This is a chicken. It is a creature lovingly and internally referred to as a Thwomp, like the enemy of the same name from the beloved Super Mario Bros. It will probably seem edible to some players, and I must admit it has made me rather hungry sometimes.

Most of the time, it just hangs in the air, and it will stay there as long as we can control our hunger-pangs.

But sometimes, this happens.

Thwomp Smash

Oops, this can be dangerous. Let's see how these monsters work.

Let's start with the basics. We will make a list, which will consist of all possible actions of the chicken. Our chicken should be able to:

  • Wait for its victim in the air
  • Attack the victim
  • Rise to the starting position

We have several sprites that animate the chicken. Let's output these sprites as a sequence:

spr=oam_meta_spr(chickenX, chickenY, spr,


Now our chicken can hang in the air. Look at the first image again to see his delicious turkey jive.

Thwomp Smash!

Suppose our chicken has spotted prey. Now it needs to rush to the enemy, and try to squash it. Perhaps it will also stain you with fat in your game. It all depends on your imagination.

All we need to do is change the animation and increase the position of the chicken along the Y axis each frame. I think 4 pixels per frame will be ok, but you can experiment on your own. 


But something has to stop the chicken. Otherwise, it will fly through the entire screen like an asteroid in a looping way, and this will not make any sense, so you have to add a condition that will limit attack. This may be the presence of the enemy or the floor under the chicken. 

Stopping it might look like this (I will use pseudocode):

if (chickenY < someObjectY)


Then we have to get the chicken back. We will raise it by 1 pixel for each frame.

if (chickenY > basicPositionY)


And now we will collect everything in one cycle:

while (gameLoop) {

    switch (chickenStatus) {


        // print sprite
            spr=oam_meta_spr(chickenX, chickenY, spr,
          // Do not forget about the condition sufficient to start the attack:
           if (playerX==chickenX)



// next state - attack
          spr=oam_meta_spr(chickenX, chickenY, spr,
          // maybe there is some ground here
          if (isGround(chickenY))
          // and if so
// and back over again:

        spr=oam_meta_spr(chickenX, chickenY, spr,


        // if Y = basic position Y
       if (chickenY==basicPosY)
        // back it to idle mode



What Else is in the Fridge?

Let's consider another enemy. It’s a ghost. Our character cannot destroy this ghost on his own, but he can use his own supernatural thermokinesis ability to light a candle. This will destroy the specter. 

Again, we need to provide states for this enemy - the ingredients of his behavior:

  • Ghost patrols the platform;
  • Ghost attacks the player if the distance between the player and the ghost is 4 cells or less;
  • Ghost dies if there is a lit candle within two cells.

Voracious Ghost

This same process can also be performed with bosses. Just describe how the boss should behave. It could be something like this:

  • Hunting - Boss patrols platforms at the same height as the player
  • Attack - Boss throws a hatchet at the player

Use telekinesis to throw the cleaver back!



Coding enemies and populating your game with dangerous, fun, and tasty creatures is possible if you skillfully use the state and parameters of objects. Try it yourself!

                                                         – – –

Want more tips straight from the retro pros? Welcome to our Discord!

Get mad meat on The Meating page now!

Latest Jobs


Playa Vista, California
Audio Engineer

Digital Extremes

London, Ontario, Canada
Communications Director

High Moon Studios

Carlsbad, California
Senior Producer

Build a Rocket Boy Games

Edinburgh, Scotland
Lead UI Programmer
More Jobs   


Register for a
Subscribe to
Follow us

Game Developer Account

Game Developer Newsletter


Register for a

Game Developer Account

Gain full access to resources (events, white paper, webinars, reports, etc)
Single sign-on to all Informa products

Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Follow us


Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more