C
Clockwatcher
Guest
Hey guys, n00b here trying to get into Game Maker during the bajillionth COVID lockdown. Any help is super appreciated!
Was following along with Shaun Spalding's Complete Platformer thing and thought it'd be funny for the gun to launch you in the air. Managed to get it working but unfortunately when the gun sends me airborne I fly through walls and off the screen. Not sure what to do because when I'm jump and move normally, the collisions work fine.
I posted code below. Already copied and paste my horizontal and vertical collisions into the mouse check (while changing vsp/hsp to my airbornerecoil value) but it wouldn't work.
Apologies if this is painfully obvious or dumb. If you take a glance at this thread, thank you
Was following along with Shaun Spalding's Complete Platformer thing and thought it'd be funny for the gun to launch you in the air. Managed to get it working but unfortunately when the gun sends me airborne I fly through walls and off the screen. Not sure what to do because when I'm jump and move normally, the collisions work fine.
I posted code below. Already copied and paste my horizontal and vertical collisions into the mouse check (while changing vsp/hsp to my airbornerecoil value) but it wouldn't work.
Apologies if this is painfully obvious or dumb. If you take a glance at this thread, thank you
Code:
// Horizontal Collision
if place_meeting(x + hsp, y,obj_wall){
while (!place_meeting(x+sign(hsp), y, obj_wall))
{
x = x + sign(hsp);
}
hsp = 0
}
x = x + hsp
// Vertical Collision
if place_meeting(x, y + vsp,obj_wall){
while (!place_meeting(x, y+sign(vsp), obj_wall))
{
y = y + sign(vsp);
}
vsp = 0
}
y = y + vsp
// Gun Kick
airbornerecoil = 20
KickDirection = (obj_gun.image_angle +180)
if mouse_check_button(mb_left)
{
x = x + lengthdir_x(airbornerecoil, KickDirection)
y = y + lengthdir_y(airbornerecoil, KickDirection)
}