OblivionSkull21
Member
I got my movement code AGES ago from this video by HeartBeast:
The reason why I'm wanting to check for these collisions is because the hspd and vspd are NEVER zero if the player is pressing a movement button, EVEN IF they are running into a wall.
This is causing a hiccup in displaying my quests screen, which adds the hspd/vspd to the quest object's coordinates. Basically, in order to make sure a portion of the quests screen is drawn in the right spot, I have to add the player's hspd/vspd to the quest object's coordinates, otherwise it "slides" into place rather than being in place already.
How I have the quests menu set up is too complex to dive into. All I need is one of these two things:
A.) Some way to detect if there is another physics object in the way before the player tries to move that direction, so I can set hspd/vspd to zero then.
B.) Some way to save the player's coordinates as a variable every second, then compare their current location to that variable to see if it has changed.
The reason why I'm wanting to check for these collisions is because the hspd and vspd are NEVER zero if the player is pressing a movement button, EVEN IF they are running into a wall.
This is causing a hiccup in displaying my quests screen, which adds the hspd/vspd to the quest object's coordinates. Basically, in order to make sure a portion of the quests screen is drawn in the right spot, I have to add the player's hspd/vspd to the quest object's coordinates, otherwise it "slides" into place rather than being in place already.
How I have the quests menu set up is too complex to dive into. All I need is one of these two things:
A.) Some way to detect if there is another physics object in the way before the player tries to move that direction, so I can set hspd/vspd to zero then.
B.) Some way to save the player's coordinates as a variable every second, then compare their current location to that variable to see if it has changed.
Code:
/// @description scr_move_state
scr_get_input();
//Get direction
dir = point_direction (0, 0, xaxis, yaxis);
//Get length
if (xaxis == 0 && yaxis == 0) {
len = 0;
} else {
len = spd;
}
//Get the hspd and vspd
hspd = lengthdir_x(len, dir);
vspd = lengthdir_y(len, dir);
//if text appears
if global.tboxActive = true {
spd = 0;
}
if instance_exists(obj_save_popup){
spd = 0;
}
//Move
phy_position_x += hspd;
phy_position_y += vspd;