top of page
  • Writer's pictureBruce

Let's create an MPAGD game - Part 10 - A first enemy and animation

Updated: Oct 30, 2021

We are going to need an enemy sprite...so head back to the sprite editor.


Here's Stinky Dogs nemesis....Sideways Clive (no relation to Sir Clive)



When we created the Stinky Dog sprites, each sprite had a single FRAME. But MPAGD allows each sprite to have multiple FRAMEs that it will cycle through in order to animate the sprite.


Let's create another Frame for Sideways Clive...press the 'I' key to insert, the editor box will go plank and in the info area it will say Sprite 002 Frame 001 (the first frame is always 000)


  • To flip back to the first frame press 'D'

  • Press M to copy it

  • Press F to go to the new Frame

  • Press K to paste the original frame into the new frame

Now we'll just change Sideways Clive's Arms and legs so that they form the opposite of the original frame... like this:




If you press D then F and alternate between them, you'll get an idea of how it will animate within the game...amazing!


OK. Next we're going to need some code that will control how Sideways Clive will operate in the game. Again, we'll get MPAGD to automatically create some code for us. So let's head back to the Script Generator (remember its in the Tools Menu)


We need to be careful not to overwrite our works so far., Let's add Sideways Clive into Event 1, click on the type options and stop at 'Horizontal Patrol' - this is a script that will make Sideways Clive keep moving from left to right.


Then select your enemy sprite by clicking in the L and R boxes until you get to Sideways Clive (or your own one!) As we are going to create him as a Horizontal Patrol he will only be able to move Left and Right so we don't need to worry about the Up (U) and Down (D) boxes


Make sure all of the other rows are set to EXISTING - this will tell the Script Generator not to overwrite the other scripts.


When you are ready click Generate Scripts.


Now let's add Sideways Clive to the screen, back to the Sprite Positions editor we go...

Click on Sideways Clive in the sprite bank he'll now appear in the top left cornet of your screen



However, we need to move him into the play area properly (click to drop him into position), then click him again so his details appear in the info box, also note that in the info box his sprite type is set to Player Respawn, if you click the image in the info box he will cycle to the next sprite type - we want him in the type 1 script:




OK time to test the game - from the File Menu select Build...this should happen...




Play this marvellous game...note that when Stinky Dog touches Sideways Clive a life is lost and Stinky Dog is respawned at the position we set for him in Sprite Positions.


Congratulations, go and have a cup of tea...you are now an official indiedev! and we still haven't had to write a single line of code...don't worry...it's coming.


Our game though, is lacking an objective. Let's give Stinky Dog a purpose and give him something to collect, head back to the Block editor...



1,166 views0 comments

Want to support my work?....Buy my games!

aboutME

Hello, I'm Bruce and I write games for old 8bit computers using Jonathan Cauldwell's excellent Multi-Platform Arcade Games Designer (MPAGD)

I've written a few successful* games for the Sinclair ZX Spectrum and MSX platforms that have been (largely) well received including Twenty Four Hour Parsley People scoring a 10 out of 10 on Planeta Sinclair.

In my blog I am sharing lots of the code that I wrote for my games, in a way that you can use in your own games.   I've commented it so that you'll learn some of the techniques I use to create interesting new mechanics and help your games stand out from the pack.

MPAGD includes lots of standard scripts, they're great to get you started, but if you're new (or just rusty) when it comes to writing code, hopefully my tutorials will help you get started and  turn your imagination into awesome 8 bit games!

All my code is free to use and do with as you please, but if you find them useful please feel free to buy me a coffee ...or better still - buy or download my games :)

*successful is a very relative term in 8bit computer games

bottom of page