kamera : komennot

POINTCAMERA


   KUVAUS

Tämä komento pistää kameran osoittamaan objektin suuntaan. Myöhemmin kameraa voi esimerkiksi liikuttaa eteenpäin - kohti objektia.

   KÄYTTÖ
POINTCAMERA objekti

  • objekti = Objektimuuttuja, mihin objekti ladattiin tai luotiin.

  • Katso myös: POINTOBJECT

       ESIMERKKI
    FrameLimit 40

    'Make infinite grass
    floor=MakeObjectFloor()
    lawn=LoadImage("Media\grass.bmp")
    PaintObject floor,lawn

    target=LoadObject("Media\crosshair.bmp")

    AddText "Move the crosshair with arrows..."

    Repeat

        'move the crosshair at speed 2
        If LeftKey() Then TranslateObject target, -3,0
        If RightKey() Then TranslateObject target,3,0
        If UpKey() Then TranslateObject target,0,3
        If DownKey() Then TranslateObject target,0, -3

        'Point camera to the crosshair and move it
        'towards
        PointCamera target
        MoveCamera 1

        'Visualize the camera angle
        DrawGame
        Circle 190,140,20,OFF
        Line 200,150,200+Cos(CameraAngle())*10,150-Sin(CameraAngle())*10

        DrawScreen

    Until EscapeKey()

    <<TAKAISIN