Floofy Posted April 12, 2012 Report Share Posted April 12, 2012 I'm working on a new engine using Damizean's 360 Movement as a base. Everything's going well so far, but the moving platform code isn't working. I'm not sure what to do about that... Can anyone direct me to a moving platform code that works? Link to comment Share on other sites More sharing options...
DimensionWarped Posted April 12, 2012 Report Share Posted April 12, 2012 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 More sharing options...
Floofy Posted April 12, 2012 Author Report Share Posted April 12, 2012 Yeah, I'm planning on learning construct sooner or later, I'm doing this engine for a friend. Anyways, I'll see if I can port the movement from worlds to this engine. Link to comment Share on other sites More sharing options...
Serephim Posted April 12, 2012 Report Share Posted April 12, 2012 Moving Platforms were the final straw with me and MMF2, now that i think about it. It sucks with decimals so i only used whole numbers with the movements. In construct however they were pretty braindead to implement. Link to comment Share on other sites More sharing options...
VectorSatyr Posted April 12, 2012 Report Share Posted April 12, 2012 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 More sharing options...
Floofy Posted April 12, 2012 Author Report Share Posted April 12, 2012 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 More sharing options...
VectorSatyr Posted April 12, 2012 Report Share Posted April 12, 2012 Start with this, for now. EDIT: Animations are case-sensitive. If an animation is not playing that you think should be playing, chances are you either spelled it wrong when you tried to apply it, or it wasn't properly loaded. Link to comment Share on other sites More sharing options...
Floofy Posted April 12, 2012 Author Report Share Posted April 12, 2012 Start with this, for now.EDIT: Animations are case-sensitive. If an animation is not playing that you think should be playing, chances are you either spelled it wrong when you tried to apply it, or it wasn't properly loaded. Actually, I'm using MMF2. Link to comment Share on other sites More sharing options...
VectorSatyr Posted April 12, 2012 Report Share Posted April 12, 2012 Oh... welp! Can't help you there. Sorry. =( Link to comment Share on other sites More sharing options...
Floofy Posted April 12, 2012 Author Report Share Posted April 12, 2012 Oh... welp! Can't help you there. Sorry. =( Not a problem, Thanks for being willing to help :3 Link to comment Share on other sites More sharing options...
Serephim Posted April 12, 2012 Report Share Posted April 12, 2012 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 More sharing options...
Floofy Posted April 13, 2012 Author Report Share Posted April 13, 2012 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 More sharing options...
Recommended Posts