Difference between revisions of "Setting Screen Entry Points"
m (1 revision) |
|||
Line 7: | Line 7: | ||
<div class="CodeBlockHeader">Code:</div> | <div class="CodeBlockHeader">Code:</div> | ||
− | <syntaxhighlight lang="sci">(switch(gPreviousRoomNumber) | + | <syntaxhighlight lang="sci" class="cs">(switch(gPreviousRoomNumber) |
(case 500 (send gEgo:view((send gEgo:view))loop((send gEgo:loop))posn((send gEgo:x) (send gEgo:y))init())) | (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())) | (case 3 (send gEgo:view((send gEgo:view))loop((send gEgo:loop))posn(45 (send gEgo:y))init())) |
Latest revision as of 15:38, 5 August 2013
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.
(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.