M
Marco Savarese
Guest
Hello everyone, i've been trying to make a good chest opening system. First, having a chest placed in the map, it will open only if the player is in its radius and presses the space key. Also, i want this to happen only if the player is facing in the right direction. So, if the player's on the chest's left, he should be looking towards it, at the player's right. I managed to make the first point, but not the second one. Here's the code. How should I change it?
Player's image index is: 0-faces down, 1- faces up, 2-faces right, 3-faces left
global.range=1;
if (distance_to_object(obj_player) = global.range)
{
image_index=1; //chest image index
}
Player's image index is: 0-faces down, 1- faces up, 2-faces right, 3-faces left
global.range=1;
if (distance_to_object(obj_player) = global.range)
{
image_index=1; //chest image index
}