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...
Commentaires