sonic101 Posted July 4, 2006 Report Share Posted July 4, 2006 okay im having trouble finding a decent tutorial on how to do vertical moving platforms in game maker. all of them work fine until it comes time for the player to move back down. it just lets the player fall rather then bring the player with it which causes problems for those with games that have a different falling sprite then a standing sprite. and often i find they have it so when you are moving up when it comes time to move back down the player actually bounces up before going down. does anyone know how to do actual working vertical moving platforms? or ones that move in all directions, like ones that go in circles? Link to comment Share on other sites More sharing options...
Gradient Posted July 4, 2006 Report Share Posted July 4, 2006 For motion, a path might be your best bet for making the platform move in a circle. For up-down platforms, I use this code for motion: nformation about object: obj_platform_verSprite: <no sprite>Solid: falseVisible: trueDepth: 0Persistent: falseParent: obj_wallsMask: <same as sprite>Create Event:COMMENT: Variablesexecute code:var xdir;var turn;var noturn;COMMENT: Setupexecute code:xdir=1;turn=0;noturn=0;Alarm Event for alarm 0:execute code:if (noturn=1) noturn=0; Step Event:COMMENT: Movementexecute code:if (xdir=1) vspeed+=0.08;if (xdir=0) vspeed-=0.08;if xdir=1 {if (vspeed>2.3) vspeed=2.3 }if (xdir=0) {if (vspeed<-2.3) vspeed=-2.3 }Collision Event with object marker:execute code:if (noturn=0) {xdir=!xdir;noturn=1;alarm[0]=60; }[/CODE]This lets you place a small marker wherever you want the platform to change direction. It also causes the platform to slow down and speed up smoothly. As for how to stay put on platforms, pass. I'm as interested as you are. Link to comment Share on other sites More sharing options...
super master Posted July 4, 2006 Report Share Posted July 4, 2006 dude you've lost me XD Link to comment Share on other sites More sharing options...
Gradient Posted July 4, 2006 Report Share Posted July 4, 2006 Platform, moves up and down with a nice smooth motion. Simple. /\ _ /\ Link to comment Share on other sites More sharing options...
sonic101 Posted July 4, 2006 Author Report Share Posted July 4, 2006 the up and down is easy, its the getting the player to stay on the platform im looking for. Link to comment Share on other sites More sharing options...
Kain Posted July 4, 2006 Report Share Posted July 4, 2006 Before Sonic's movement (in the Begin Step event) execute this code: follow = instance_place(x,y+2,obj_movingPlatform); After Sonic's Movement (in the End Step event) perform this code: if(follow) { x += follow.x - follow.xprevious; y += follow.y - follow.yprevious; } That works for platforms moving in any direction, but works best with paths and might not work it you do complicated movement for the platform using your own variable (in which case you should make your own x/yprevious). Link to comment Share on other sites More sharing options...
rogueyoshi Posted August 24, 2006 Report Share Posted August 24, 2006 i know this thread is old, but since you still need help with this, i will do it gladly. first make a parent object called objMovingPlatform, and make its parent object your platform parent object(if you dont use one, just make the your solid parent object its parent). next, in the create event of objMovingPlatform, put in this code: previous_x = x; previous_y = y;[/CODE]after that in the end step event put this:[CODE] previous_x = xprevious; previous_y = yprevious;[/CODE]now, make a new object and call it objlvl1Platform, and make objMovingPlatform its parent. also give it whatever sprite/mask you want it to have.next, in your player's step event, put this code:[CODE] // ---- Moving platforms --------------------------------------------------------------------- objHandle = instance_place(x,y+2, objmovingPlatform)// change the y+2 part to suit your character's collision mask; if (objHandle != noone && onGround) { x -= objHandle.previous_x - objHandle.x; y -= objHandle.previous_y - objHandle.y; }[/CODE]next, place your platform and fire up your game.change varaible/object names to suit your game. Link to comment Share on other sites More sharing options...
Recommended Posts