hello, one question, how do I make my character enter a house by pressing a button, every time I try my character appears in a different position, please help
would need a lot more information. how are you implementing the inside of the house? is that a room of its own or you moving to another area of the map or what? code would help too.
For now I am doing tests and I simply put a house_object and I want my character to interact with him entering the house (another room) but every time I do it my character appears in another position, then I will see what to move between areas but for now only is entering and leaving a house
I try but it is also that the room where the house is inside I also want to use it to put the rest of the rooms of the rest of the houses, and every time the player enters the house, it appears in the room that it should but not in the place that should
if all the houses are are going to be stored on the same level then you need to set a global variable before changing rooms for where you want the player to appear in the inside room. If you have a door x and y global then all you have to do is when you load the level just grab it when the level starts and move the player.
I was investigating and I saw that the persistent character could be put, that is, that he is always in all the rooms, I would like to use that mechanism for simply when he crosses the door of the house he is teleported to the room of the rooms (which I knew how to handle in a way) be placed inside said house
obj_player collision event with obj_house_1_door
room_goto(rm_house_1)
rm_house_1 creation event // the room, not the house object
obj_player.x = 100 // change to where you want the player to enter at
obj_player.y = 100 // change to where you want the player to enter at
obj_player collision event with obj_house_1_door_to_town
room_goto(rm_town)
obj_player.x = 100 // change to where you want the player to enter at
obj_player.y = 100 // change to where you want the player to enter at
just be sure to place the landing points far enough away from the door objects so there is no constant room switching ;o)
I made mine with a scrolling viewport and all the rooms were at the bottom out of range
when you enter the warp object the viewport shows the room you entered
the character is placed in the room with the warpers instance creation code (not the objects)
so the character can be placed in different positions ...say you entered from the left..this could allow for more than one portal out
if you would like me to post any code i can show you how i did it
Thank you very much for your help, another question, how can I get my player to enter a door not with a collision but with an interaction, that is to say that I, being close to the door when pressing a key (E), enter the house?
well that can be right on the warper object...when colliding with the warper if the E key is pressed then warp
i made my sprite for the warper semi transparent..so its a visual reference in the editor but its visibilty is turned off so its invisible in gameplay
you can aslo do it with the distance_to_point func
placed on door obj
if keyboard_check_pressed(ord("E"))
{
if distance_to_point(obj_Player.x, obj_Player.y) < 100
{
goto_house_function();
}
}