How to Make Moving Platforms
Author: | RapidFlash
|
Submitted: | 28th October, 2003
|
Views: | 5142
| Rated: |
|
|
I haven't written an article in quite some time so I've decided to put this one out for all the people wondering how to do this.
Now, the first thing you need is, obviously, a working movement. If you want to be able to jump through the platform, then you're going to need a working platform movement (it isn't as hard as it seems, just use bottom detectors or the new custom platform movement extension).
Okay, you already had that. Now what should you do?
The first step is to create your moving platform. Create a new active, draw the sprite ( or have no shame and rip one of the internet ), and place it. Be sure not to assign a path movement to it, it'll mess up the whole thing.
Now go to the event editor. Assign its movement now by doing either one of two things: have it timed using any method, including the built in timer and FastLoop, or have it change directions when it bounces off the wall.
Here's what you do to make it move with a timer movement:
Start of Frame --> Set Alterable Value A to 2
Alterable Value A = 2 --> X Pos = X Pos + 3
Alterable Value A = 3 --> X Pos = X Pos - 3
Every 2"-00
Alterable Value A = 2 --> Set Alterable Value A = 4
Every 2"-00
Alterable Value A = 3 --> Set Alterable Value A = 5
Every 0"-06
Alterable Value A = 4 --> Set Alterable Value A = 3
Set Direction to 16
Every 0"-06
Alterable Value A = 5 --> Set Alterable Value A = 2
Set Direction to 00
Here's what you do to make it move with a collision movement:
Start of Frame --> Set Alterable Value A to 2
Set Direction to 00
Alterable Value A = 2 --> X Pos = X Pos + 3
Alterable Value A = 3 --> X Pos = X Pos - 3
Active collides with the background
Alterable Value A = 2 --> Set Alterable Value A = 4
Active collides with the background
Alterable Value A = 3 --> Set Alterable Value A = 5
Every 0"-06
Alterable Value A = 4 --> X Pos = X Pos + 1
Set Alterable Value A = 3
Set Direction to 16
Every 0"-06
Alterable Value A = 4 --> X Pos = X Pos - 1
Set Alterable Value A = 2
Set Direction to 00
But wait! You're not done. You want your character to follow with this moving platform. The first thing you'll need to do is, of course, make it so your player stays on the platform, with which you make it happen with your engine. Then you do these lines of code:
Active2 is overlapping Active
Alterable Value A = 2 --> ( Active 2 ) X Pos = X Pos + x
Active2 is overlapping Active
Alterable Value A = 3 --> ( Active 2 ) X Pos = X Pos - x
Replace x with how much your platform moves e.g. in this case it would be 3. Active2 is whatever needs to be on the platform for the player to stay on it ( could be a character or a detector ).
Wow, that was easy! Now you've learned how to make moving platforms and have character stay on them! I hoped you've learned something.
|
|
RapidFlashSavior of the Universe Registered 14/05/2002
Points 2712
|