Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: How do you load the same room from multi angles?  (Read 2264 times)

0 Members and 1 Guest are viewing this topic.

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
How do you load the same room from multi angles?
« on: September 23, 2007, 07:55:33 AM »

I have a room that has entrances from three other rooms AND two of those rooms have 2 exits that both lead to the same room...



So upshot is that the green and the blue room have two separate exits that lead to the ONE room and each exit appears on a different location in that one room.


I was using

Code: [Select]
if(Game.PrevScene=="stairs_right_inn")
{
actor.SkipTo(195, 205);
actor.Direction = DI_DOWN;
}
if(Game.PrevScene=="stairs_right_inn")
{
actor.SkipTo(830, 205);
actor.Direction = DI_DOWN;
}
if(Game.PrevScene=="enter-left")
{
actor.SkipTo(514, 716);
actor.Direction = DI_UP;
}

as it can load a new actor start pos based on the last scene but HOW do i handle the green and blue room... where that last scene call will not work as there are TWO different positions in the main room from two different exits in each of those rooms.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: How do you load the same room from multi angles?
« Reply #1 on: September 23, 2007, 08:37:40 AM »

Whenever you need to pass information from one scene to another, use global variables.
In the original scene, when leaving it, set a global variable to some value:

Code: WME Script
  1. global InnStairsExitType = "left";
  2. Game.ChangeScene("blah.scene");
  3.  

And in the new scene, check the value of the variable and set the initial position appropriately.

Code: WME Script
  1. if(Game.PrevScene=="stairs_right_inn")
  2. {
  3.   global InnStairsExitType;
  4.   if(InnStairsExitType == "left")
  5.   {
  6.     // we came from the left entrance
  7.     actor.SkipTo(195, 205);
  8.     actor.Direction = DI_DOWN; 
  9.   }
  10.   else
  11.   {
  12.     // we came from the right entrance
  13.     actor.SkipTo(514, 716);
  14.     actor.Direction = DI_UP;
  15.   } 
  16. }
  17.  
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.048 seconds with 20 queries.