Fangames > Programming Questions

Upwards moving solid block

(1/1)

ShutUpNerd:
So I wanted to make a solid block that would move upwards and also be able to carry the player upwards like a platform
Because of the way gamemaker treats solid objects this has proven extremely difficult to do, and I honestly cannot think of anything I haven't tried yet.

Does anybody know how this could be done?

YoSniper:

--- Quote from: ShutUpNerd on January 03, 2015, 06:00:03 PM ---So I wanted to make a solid block that would move upwards and also be able to carry the player upwards like a platform
Because of the way gamemaker treats solid objects this has proven extremely difficult to do, and I honestly cannot think of anything I haven't tried yet.

Does anybody know how this could be done?

--- End quote ---

While I don't recommend using solid objects at all in Game Maker, I think the best approach is to set the player's y coordinate upon colliding with the player, i.e. something like:


--- Code: ---if place_meeting(x, y-1, player) {
    player.y = y - 8;
}
--- End code ---

Note that this is not complete nor foolproof code. Again, I don't recommend using solid objects, but this might get you on the right track.

ShutUpNerd:

--- Quote ---While I don't recommend using solid objects at all in Game Maker, I think the best approach is to set the player's y coordinate upon colliding with the player, i.e. something like:


--- Code: ---if place_meeting(x, y-1, player) {
    player.y = y - 8;
}
--- End code ---

Note that this is not complete nor foolproof code. Again, I don't recommend using solid objects, but this might get you on the right track.

--- End quote ---

alright, so i started making this object a non solid one, everything mostly works except when the platform goes upwards the kid kinda spazzes and when i try to jump off it it only gives me one jump

i have this in the step event


--- Code: ---with(player){
if(place_meeting(x,y+vspeed,thwomps))
{
if y < other.y

{
    y = other.y-9;
    vspeed = other.vspeed;
 
 
  onPlatform = 1;
  djump = true;
}

if  y > other.y{move_contact_all(90,abs(vspeed));vspeed=0}
}
}

--- End code ---

note that those variables are from yuutu engine

lemonxreaper:
if you get the newest version of yuuutu (2.1)
there is an object called LiftBlock
i think maybe that's the kind of thing you are looking for.

ShutUpNerd:

--- Quote from: lemonxreaper on January 04, 2015, 11:23:45 AM ---if you get the newest version of yuuutu (2.1)
there is an object called LiftBlock
i think maybe that's the kind of thing you are looking for.

--- End quote ---
thanks, but the case has been solved, i managed to make an object that mimics a solid block but has the riseBlock parent



Navigation

[0] Message Index

Go to full version