Author Topic: How To Move A View Then Trigger An Event  (Read 2359 times)

0 Members and 1 Guest are viewing this topic.

Offline Brian Provinciano

How To Move A View Then Trigger An Event
« on: July 05, 2002, 11:07:30 PM »
I will have the next tutorial done is a week or so, but until then, I thought I'd post a response to a question for all to benefit.

To move a view from one place to another, then do something when it reaches it's destination, you use the view's setMotion method with the RoomScript's changeState method.


Here's an example:


/******************************************************************************/
(instance public rm001 of Rm
   (method (init)
          ...        
          (aMan:
                 init()
                 setCycle(Walk)
                 setMotion(MoveTo 180 150 RoomScript)
          )
   )
)
/******************************************************************************/
(instance aMan of Act
   (properties
      y 170
      x 190
      view 1
   )
)
/******************************************************************************/
(instance RoomScript of Script
   (properties)
   (method (changeState newState)
          = state newState
          (switch (state)
                 (case 0
                     Print("This is state 0! The room has started!")
                 )
                 (case 1
                     Print("The view has moved to it's first position!")
                     (aMan:
                           setMotion(MoveTo 150 140 RoomScript)
                     )
                 )
                 (case 2
                     Print("The view has moved to it's second position!")
                 )
          )
      )
   ...
)



Joe

  • Guest
Re:How To Move A View Then Trigger An Event
« Reply #1 on: July 06, 2002, 07:50:48 AM »
Ohhhhh.  That would be like using flags right?  Cool Brian.  Can't wait till the next tutorial.  Keep up the good work!


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.028 seconds with 17 queries.