Adding Classic-style movement to your platform enemies.

Index

Stats

9,989 visits, 31,444 views

Tools

Looking around the website, I haven't come across any tutorials that focus solely on this subject. Some mention it, but I aim to go into greater detail.

In classic platformers such as Mario, or MegaMan, some, or all of the enemies move in a certain way: back and forth along a platform. This effect has nothing to do with AI, or anything of the sort, and is actually quite straight forward.

In this tutorial, I will assume that you already know how to add sprites into the game, as well as animations, if you choose to use them.

STEP 1

Adding the floor

First of all, we need a floor for our enemy to stand on. If you already have one (which you probably do, if you already have a player sprite), then skip to step 2. Otherwise, keep reading.

Double-click your layout to add a new object, and click 'Sprite'. Hit 'insert' and click somewhere on your layout.

In the art box, draw your floor sprite. I personally recommend using a square size like 32x32, 64x64 or 128x128. These square sprites are handy as they can be duplicated and placed using the grid to create retro-style platforms.

Click once on your sprite and in the properties bar to the left, select 'add/edit behaviors'. When the 'Sprite behaviors' window pops up, tap the plus icon and choose the 'solid' behavior.

Close this window and duplicate your tile with CTRL Click Drag to create a platform. The best platforms are at least 3 tiles long.

Once you've got your platform, you've completed this step!

  • 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