V
vududu
Guest
i followed a beginner guide for game maker from a guy called Shaun Spalding and the guy made 2 objects collide with each other, i did the exact same thing as he did but my objects dont collide at all instead when the player object reaches the floor object(object2 in the code), the player object slowly passes through the floor, when the entire player object passes through the floor GM studio 2 stops working and i need to close and open again. what am i supposed to do?
i am using game maker:studio 2 version: 2.1.5.322
Code:
// input
key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check_pressed(vk_space);
// movement
var movement = key_right - key_left;
hspeed = movement * image_speed;
vspeed = vspeed + gravity;
//horizontal
if (place_meeting(x+hspeed,y,object2))
{
while (!place_meeting(x+sign(hspeed),y,object2))
{
x = x + sign(hspeed);
}
hspeed = 0;
}
x = x + hspeed;
//vertical
if (place_meeting(x,y+vspeed,object2))
{
while (!place_meeting(x,y+sign(vspeed),object2))
{
y = y + sign(vspeed);
}
vspeed = 0;
}
y = y + vspeed;
i am using game maker:studio 2 version: 2.1.5.322
Last edited by a moderator: