X
XirmiX
Guest
So, currently I have set up for my game pretty complex spawn points. One of these complex parts is that there are two doors that open and close. The doors are set up to move in a certain direction from their current position when a player spawns in that spawn point:
Step event for one of the doors (most of this code isn't too relevant; the key areas of interest are where phy_position_y is being changed)
The problem, however, is that when the spawn point is rotated, the doors don't change the direction in which they move; say if you rotated the spawn point by 90 degrees, the doors should move one to the left and the other to the right to open up, but instead they move one upwards and one downwards as if the spawn point wasn't rotated, making a weird, unintended type of movement.
What should happen:
What happens:
My question is, how can I change it so that the movement changes based on the rotation of its parent spawn point (the closest spawn point to it) as a whole and/or, based on the parent spawn point's local axis of sorts instead of the global axis. Though, I think this is essentially the same thing in this scenario.
Step event for one of the doors (most of this code isn't too relevant; the key areas of interest are where phy_position_y is being changed)
Code:
if (parent_spawn.spawnable == false)
{
if(open_door && round(phy_position_y) != (parent_spawn.y-90))
{
phy_position_y --;
show_debug_message("Door 1 physics 'Y' position: " + string(round(phy_position_y)));
show_debug_message("Spawnpoint 'Y' position: " + string(parent_spawn.y-90));
}
else if(open_door && round(phy_position_y) == (parent_spawn.y-90))
{
open_door = false;
}
else if(open_door == false && round(phy_position_y) != parent_spawn.y)
{
if (parent_spawn.free_spawn == true)
{
phy_position_y ++;
}
}
else if(open_door == false && round(phy_position_y) == parent_spawn.y)
{
if (parent_spawn.spawnable != true)
{
parent_spawn.spawnable = true;
}
}
}
The problem, however, is that when the spawn point is rotated, the doors don't change the direction in which they move; say if you rotated the spawn point by 90 degrees, the doors should move one to the left and the other to the right to open up, but instead they move one upwards and one downwards as if the spawn point wasn't rotated, making a weird, unintended type of movement.
What should happen:
What happens:
My question is, how can I change it so that the movement changes based on the rotation of its parent spawn point (the closest spawn point to it) as a whole and/or, based on the parent spawn point's local axis of sorts instead of the global axis. Though, I think this is essentially the same thing in this scenario.