Author Topic: How to change screen entry positions to exact locations?  (Read 1478 times)

0 Members and 1 Guest are viewing this topic.

Offline jtyler125

How to change screen entry positions to exact locations?
« on: January 12, 2007, 10:06:22 AM »
Ok, yes...I am still a dumb newbie.

OK, we have all read the sci tutorial which tells use how to put gEGO in a certain position in the room that you just walked into useing the case commands...but if you are writing a game where you want the Ego to appear in the eaxct spot in the next screen where you entered from the other screen...how do you do that?

1)  How do you write a script so Ego appears in an exact position from where he entered from the previous screen?


2)  Also, how do you make an actor chase you from one room to the next and appear in this same position?



Thanks,
JT


Life is getting better all the time.
Groundhog Day Competition New Year's Competition

Offline Cloudee1

Re: How to change screen entry positions to exact locations?
« Reply #1 on: January 12, 2007, 04:00:27 PM »
When you are moving from one room to another, if you want the ego's last position reflected then you 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: [Select]
  (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

As far as making a character follow the ego from room to room, I would probably 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.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.112 seconds with 23 queries.