KPJ
Member
I am working on a top down shooter game, I want to implement doors, that swing open and closed slowly everytime the player is close to it and presses F.
Also, when i try and open the door, all doors are affected, not just one. I am aware of using other(), but I just can seem to find out how to use other() in this situation
But when I run the game and press F, the door is just offset by a tiny amount and nothing else happens. Any help?
Code:
Note: I am using the sprite origin (set to bottom left) as the hinge, using image_angle
Any help would be appreciated. Thanks!
Also, when i try and open the door, all doors are affected, not just one. I am aware of using other(), but I just can seem to find out how to use other() in this situation
But when I run the game and press F, the door is just offset by a tiny amount and nothing else happens. Any help?
Code:
Code:
//Player Create
global.door = false;
//Player Step Event
if (distance_to_object(oDoor) < 40 && (keyboard_check_pressed(ord("F"))))
{
global.dooropen = true;
}
//Door object step event
if (global.door == true && image_angle == 0)
{
image_angle += 5;
if (image_angle == 90)
{
global.door = false;
}
}
if (global.door == true && image_angle == 90)
{
image_angle -= 5;
if (image_angle == 0)
{
global.door = false;
}
}
Any help would be appreciated. Thanks!