T2008
Member
I've recently had to increase the sprite size of my player for melee and shooting weapons. to be 131x132. (it was less than 100). The problem is that when I change rooms, the player's new coordinates are too much into the room. I've posted the code below. The y coordinates now crash because presumably, it's less than sprite height (this was my old code). When I change the x to be room_width less any value under sprite_width, it crashes.
Is there anyway to fix this easily? It's not an option to change the player sprite size. Any help would be greatly appreciated!!!!
Player Intersect Boundary Code:
The compass object defines the room directions for the room goto code.
Edit: I've tried (so far with just x coordinates), to adjust the player closer to boundary in Room Start Event. It seems to work but it doesn't seem like it would be the best solution to this issue. Plus, I have some door codes that push the player out at certain spots in the next room (without being part of room transition parent) that would be affected by this code (so I would have to go back and redo those). Any ideas as to a better solution?
Is there anyway to fix this easily? It's not an option to change the player sprite size. Any help would be greatly appreciated!!!!
Player Intersect Boundary Code:
Code:
{
if ( x <= 0 )
{
x += room_width-(sprite_width);
room_goto(obj_compass.west);
}
if ( x >= room_width-sprite_width)
{
x -= room_width-(sprite_width);
room_goto(obj_compass.east);
}
if ( y <= 0 )
{
y += room_height-(sprite_height-50);
room_goto(obj_compass.north);
}
Edit: The above edit isn't working so well now. This is so frustrating.
if ( y >= room_height-1)
{
y -= room_height-(sprite_height-50);
room_goto(obj_compass.south);
}
}
Edit: I've tried (so far with just x coordinates), to adjust the player closer to boundary in Room Start Event. It seems to work but it doesn't seem like it would be the best solution to this issue. Plus, I have some door codes that push the player out at certain spots in the next room (without being part of room transition parent) that would be affected by this code (so I would have to go back and redo those). Any ideas as to a better solution?
Code:
if (!instance_exists(obj_room_transition_parent)) {
if x > 1780 {
x = x+80;
}
if x < 120 {
x = x-80;
}
}
Last edited: