Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Moving platforms


Floofy

Recommended Posts

You need to be more specific than 'isn't working'. You should probably post an engine test as an example as well since Dami did like half a dozen of them (each better than the last I feel, because he's rather awesome) and it's hard to remember which is which.

For moving platform code that works, see Sonic Worlds... up to a certain speed anyway. For moving platform code that really works well in all situations, move the hell away from MMF since it's frustratingly obtuse and hard to work with. You might do well with Construct.

Link to comment
Share on other sites

In general you find a spot right after the player's x and y position has been updated, but before a new ground object has been acquired. Then you check if there IS a ground object from the previous step, and you simply add the object's movement vectors to the player's position.

This can be done without needing a specific "moving parent object" as is likely included in your build of DASH and will depend on how the object is moved. If you're using hspeed and vspeed you can simply apply those, but you can also use the numeric difference between the object's previous and current positions (ie. x-xprevious). If you use the later, you'll want to place the object's movement code somewhere before the step event so the player isn't lagging behind the object's movement.

Lastly, any translations you do to the player's position should be floor'd (floor( x )) so the player doesn't 'slide' while standing on the platform.

All of it should look similar to the following:

if (ground!=noone)
{
x += (ground.x-ground.xprevious)
y += (ground.y-ground.yprevious)
}

Link to comment
Share on other sites

In general you find a spot right after the player's x and y position has been updated, but before a new ground object has been acquired. Then you check if there IS a ground object from the previous step, and you simply add the object's movement vectors to the player's position.

This can be done without needing a specific "moving parent object" as is likely included in your build of DASH and will depend on how the object is moved. If you're using hspeed and vspeed you can simply apply those, but you can also use the numeric difference between the object's previous and current positions (ie. x-xprevious). If you use the later, you'll want to place the object's movement code somewhere before the step event so the player isn't lagging behind the object's movement.

Lastly, any translations you do to the player's position should be floor'd (floor( x )) so the player doesn't 'slide' while standing on the platform.

All of it should look similar to the following:

if (ground!=noone)
{
x += (ground.x-ground.xprevious)
y += (ground.y-ground.yprevious)
}

Thanks so much, I'll implement this.

One more thing, I'm having some problems with animations, it seems that some animations play, while some are frozen on their first frame. Any idea how to fix this?

Link to comment
Share on other sites

Freezing animations?

How are you changing them? Also, make sure no animation events or states are overlapping.

If you use "change animation frame to", then i believe you either have to use "start" or "resume animation" sometime afterwards for it to work correctly. Animation events seem to be wonky on both MMF2 and Construct to me, you kind of have to play with em and find out how to get them to continue playing like you want.

Link to comment
Share on other sites

Freezing animations?

How are you changing them? Also, make sure no animation events or states are overlapping.

If you use "change animation frame to", then i believe you either have to use "start" or "resume animation" sometime afterwards for it to work correctly. Animation events seem to be wonky on both MMF2 and Construct to me, you kind of have to play with em and find out how to get them to continue playing like you want.

I got 'em, using the force frame to timer command

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...