(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "PV")
(script 33)


(local
    newProp
    newProp_2

)
(instance public Room33 of Rm
    (properties
        picture 33
    )

    (method (init)
        = north 31
        = south 36
        = east 34
        = west 31
        = horizon 80
        = global101 0
        = gHorizon horizon
        (send gEgo:edgeHit(0))
        (super:init())
        = newProp (Prop:new())
        = newProp_2 (Prop:new())
        (send newProp:
            isExtra(1)
            view(661)
            loop(0)
            cel(1)
            posn(139 185)
            setPri(0)
            setCycle(Fwd)
            ignoreActors()
            cycleSpeed(2)
            init()
        )
        (send newProp_2:
            isExtra(1)
            view(661)
            loop(1)
            cel(3)
            posn(227 133)
            setPri(0)
            setCycle(Fwd)
            ignoreActors()
            cycleSpeed(2)
            init()
        )
        (switch (gPicture)
            (case 36
                ((send gEgo:
                    x(246)
                    y(187)
                )
  )
            )
            (case 39
                (
                (if (== (send gEgo:view()) 2)
                    (send gEgo:posn(138 188))
                )(else
                    (if (== (send gEgo:view()) 5)
                        (send gEgo:posn(113 187))
                    )(else
                        (if (== (send gEgo:view()) 6)
                            (send gEgo:posn(84 187))
                        )(else
                            (if (== (send gEgo:view()) 7)
                                (send gEgo:posn(58 187))
                            )(else
                                (send gEgo:posn(20 188))
                            )
                        )
                    )
                )
 Animate((send gCast:elements()) 0)  )
            )
            (case 34
                ((send gEgo:posn(317 (send gEgo:y())))  )
            )
            (case 31
                (
                (if (< (send gEgo:y()) horizon)
                    (send gEgo:posn((send gEgo:x()) (+ horizon 2)))
                )(else
                    (send gEgo:posn(2 (send gEgo:y())))
                )
 )
            )
        )
        (send gEgo:
            xStep(2)
            yStep(1)
            init()
        )
        (self:setRegions(505 501 503 504))
    )


    (method (doit)
        (if (>= (send gEgo:y()) 189)
            (if (< (send gEgo:x()) 160)
                = gTheGGNewPropX 39
                Animate((send gCast:elements()) 0)
            )(else
                Animate((send gCast:elements()) 0)
                = gTheGGNewPropX 36
            )
        )(else
            (if (>= (send gEgo:x()) 319)
                Animate((send gCast:elements()) 0)
                = gTheGGNewPropX 34
            )(else
                (if (<= (send gEgo:x()) 0)
                    Animate((send gCast:elements()) 0)
                    = gTheGGNewPropX 31
                )(else
                    (if (<= (send gEgo:y()) horizon)
                        Animate((send gCast:elements()) 0)
                        = gTheGGNewPropX 31
                    )
                )
            )
        )
    )


    (method (handleEvent pEvent)
        (if ((send pEvent:claimed()))
            return 1
        )
        return 
            (if ((== (send pEvent:type()) 128) and (((Said('look/around') or Said('look/island')) or Said('look/room')) or Said('look[<around][/!*]')))
                Print(33 0)
            )(else
                0
            )
    )

)
