There is two exits in bottom line and I want to go to different rooms when touching the bottom edge.
function room_LeaveBottom()
{
if (region[1].RunInteraction(1)){
player.ChangeRoom(20, 231, 115);
}
}
Maybe this is the wrong way to code.
It sounds like you want Region.GetAtRoomXY(int x, int y)
to check whether the character is standing on the region when he crosses the bottom edge. Your code would look something like:
function room_LeaveBottom()
{
if (Region.GetAtRoomXY(player.x, player.y) == region[1]){ //if the player is on region 1...
player.ChangeRoom(20, 231, 115);
}
}
RunInteraction is used when you want to execute the same code that is executed when the player stands on/walks on/walks off the region, so if you have the room function function region1_WalksOnto()
{
//Some Code
}
Then whenever you call
region[1].RunInteraction(1)
You're actually executing //Some Code
...I think anyway - I haven't ever used RunInteraction (I usually just stick things in separate functions if they are going to be used multiple time) but that's the impression the manual gives...
Hope that helps!
Thank you, geork.
The second code works.
You could simplify by not using the room_LeaveBottom function at all but simply put in two regions near the bottom of the screen and then execute player.ChangeRoom in both region_Walksonto functions.