Add this in the step event for the character
if position_meeting(x,y+10,block)
gravity = 0;
if place_free(x,y+1) //If the character is falling
gravity = 0.3; //Replace this to the gravity
<div style="clear: both;">Collision with block event
if other.solid == 1 { //If the block is solid
if vspeed >= 0 { //If the object is falling
gravity = 0;
move_contact_solid(270,10);
}
vspeed = 0; //Stop the object
}</div>
Now go to the block object and add this in the step event
//This code will make the block be solid if the character
//is above the block and not solid if it's below...
if char.y+char.sprite_height-3 >= y
solid = 0 else solid = 1;
.
Users logged in:
Comments
Loading comments...