Adding Classic-style movement to your platform enemies.

Index

Stats

9,852 visits, 31,107 views

Tools

STEP 2

Creating the monster

Now that we have a platform for our monster to walk on, we actually need to create him!

Using the same process as with the platform, create another sprite, call it something like 'monster'. This time though, we don't want to him to be a solid object! So instead of the 'solid' behavior, we'll add 'Platform'. This will allow the monster to move. Whilst you're in the properties tab, find the behaviors section, and under 'Platform' change 'Default Controls' to NO. This will stop the player from being able to control the monster, and hand over control to the script.

So here's what mine looks like now:

Of course yours will look different, but as long as the base is the same, it should be fine.

The final step in creating your monster is giving him a "detector". This is the part that detects whether he's on the edge of a platform. To do this, let's add another sprite named "detector". This doesn't need any behaviors, and should be invisible, so there's no point drawing anything on the sprite art window.

Now double-click on your monster sprite. On the bottom of the toolbar in the sprite art window, there should be a button shaped like a small cross-hair, click on it and the image point editor should appear.

Use the pencil icon in this window to create a new image point. Name this 'detector'. Now, select your new image point from the list, and place it slightly below and to the right of the monster. Select another tool in the sprite art window to close the image point editor.

In the animations pane, right-click on 'Default' and select rename. Change this to 'right'. Right-click again and select duplicate. Call the clone 'left' and then use the 'mirror' option on the image whilst 'left' is selected. If you click on the image point editor, you should now see that on the left animation, the detector point is on the left!

Close the image editor, because you're ready to start scripting!

  • 3 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Can't simulate control if you already have a player-controlled character it seems.

  • not sure what could be wrong but following this setup the "detector" instantly switches image points when testing