J
jvks2
Guest
Hello everyone,
I am trying to figure out in a platforming room with physics how to have a objectA connect to the ceiling and the player character can shoot the ceiling causing the ceiling to break and objectA falls to the ground but stops at the floor. The room is persistent and has the following code with regards to movement for the player.
//Platform Movement - Player Movement
/*Get inputs
Scr_GetInputs();
*/
//Get Inputs
var xPlatform, yPlatform;
xPlatform = keyboard_check(ord("D")) - keyboard_check(ord("A"));
yPlatform = keyboard_check(ord("S")) - keyboard_check(ord("W"));
x += xPlatform * walkingSpeed;
y += yPlatform * walkingSpeed;
key_jump = keyboard_check_pressed(vk_space);
/*might need later
key_w = keyboard_check(vk_up);
key_s = keyboard_check(vk_down);
*/
//React to inputs
if (vsp <10) vsp += grav;
//Normal Movement
hsp = xPlatform * walkingSpeed;
vsp += 0.2;
if (place_meeting(x,y+1,Obj_wall))
{
vsp = key_jump * -jumpspeed
}
//Horizontal Collision
if (place_meeting(x+hsp,y,Obj_wall))
{
while(!place_meeting(x+sign(hsp),y,Obj_wall))
{
x += sign(hsp);
}
hsp = 0;
}
x += hsp;
//Vertical Collision
if (place_meeting(x,y+vsp,Obj_wall))
{
while(!place_meeting(x,y+sign(vsp),Obj_wall))
{
y += sign(vsp);
}
vsp = 0;
}
y += vsp;
Thanks,
Jvks2
I am trying to figure out in a platforming room with physics how to have a objectA connect to the ceiling and the player character can shoot the ceiling causing the ceiling to break and objectA falls to the ground but stops at the floor. The room is persistent and has the following code with regards to movement for the player.
//Platform Movement - Player Movement
/*Get inputs
Scr_GetInputs();
*/
//Get Inputs
var xPlatform, yPlatform;
xPlatform = keyboard_check(ord("D")) - keyboard_check(ord("A"));
yPlatform = keyboard_check(ord("S")) - keyboard_check(ord("W"));
x += xPlatform * walkingSpeed;
y += yPlatform * walkingSpeed;
key_jump = keyboard_check_pressed(vk_space);
/*might need later
key_w = keyboard_check(vk_up);
key_s = keyboard_check(vk_down);
*/
//React to inputs
if (vsp <10) vsp += grav;
//Normal Movement
hsp = xPlatform * walkingSpeed;
vsp += 0.2;
if (place_meeting(x,y+1,Obj_wall))
{
vsp = key_jump * -jumpspeed
}
//Horizontal Collision
if (place_meeting(x+hsp,y,Obj_wall))
{
while(!place_meeting(x+sign(hsp),y,Obj_wall))
{
x += sign(hsp);
}
hsp = 0;
}
x += hsp;
//Vertical Collision
if (place_meeting(x,y+vsp,Obj_wall))
{
while(!place_meeting(x,y+sign(vsp),Obj_wall))
{
y += sign(vsp);
}
vsp = 0;
}
y += vsp;
Thanks,
Jvks2