Setting Screen Entry Points

From SCI Wiki
Revision as of 17:40, 22 January 2011 by Andrew Branscom (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

By Cloudee1

When moving Ego from one room to another, if you want the last position reflected you will need to use it as the variable.

For instance this code is directly from one of my games. room 500 is the inventory screen, and when you return from it you need to be in the exact spot that you left. room 3 is adjacent to the room so some variables need to stay the same like the egos y position and loop, but not all of them as you see I manually set the x. Anyway, hope this little snippet helps clear up your question.


Code:
(switch(gPreviousRoomNumber)
    (case 500  (send gEgo:view((send gEgo:view))loop((send gEgo:loop))posn((send gEgo:x) (send gEgo:y))init()))
    (case 3    (send gEgo:view((send gEgo:view))loop((send gEgo:loop))posn(45 (send gEgo:y))init()))
    (default(send gEgo:view((send gEgo:view))posn(170 130)loop(2)init()))
  ) // end switch


To make an actor chase Ego from one room to the next and appear in this same position, use a global variable, then depending on if the variable is set to true or false init the following character in the particular rooms otherwise simply don't init the character.