interaction with houses and others

K

kirink

Guest
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
 
K

kirink

Guest
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
 
Last edited by a moderator:
K

kirink

Guest
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
 

curato

Member
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.
 
K

kirink

Guest
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
 

woods

Member
something along these lines?


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)
 

Tyg

Member
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 :)
 

Attachments

K

kirink

Guest
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?
 

Tyg

Member
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();
}
}
 
Last edited:
K

kirink

Guest
And if I want that when the player approaches an interactive object, the letter with which it must interact appears above?
 

Tyg

Member
i would do it in the draw event on the house or object

if distance_to_point(obj_Player.x, obj_Player.y) < 100
{
draw_text(x, y-10, "Kirinks' House...press E to enter");
}
 
K

kirink

Guest
oh, great thank you very much for your help, any questions, I will ask you again
 
Top