kamera : komennot

CLONECAMERAPOSITION


   KUVAUS

Asettaa kameran samaan paikkaan kuin jokin objekti. Käytä tätä komentoa "liimaamaan" kamera seuraamaan haluttua objektia. Tällöin sinun on muistettava kutsua tätä komentoa joka kerta pelin pääsilmukan sisällä. Voit myös käyttää komentoa kerran keskittämään näkymän johonkin tiettyyn objektiin.

Jos seurattavassa objektissa on törmäystunnistus, kamera voi nykäistä seinää päin kävellessä. Estä tämä komentamalla UpdateGamea tätä ennen.

   KÄYTTÖ
CLONECAMERAPOSITION objekti

  • objekti = Objektimuuttuja, mihin objekti ladattiin tai luotiin.

  • Katso myös: CLONECAMERAORIENTATION

       ESIMERKKI
    FrameLimit 40

    'Enable graphics commands to cast shapes to
    'the game world
    DrawToWorld ON

    'Make an infinite lawn the guy can walk on
    floor= MakeObjectFloor()

    'Texture the EMPTY floor as grass
    lawn= LoadImage("Media\grass.bmp")
    PaintObject floor,lawn

    guy= LoadObject("Media\guy.bmp",75)

    AddText "Use arrows to move..."

    Repeat

        'Update controls
        If LeftKey() Then TurnObject guy,5
        If RightKey() Then TurnObject guy, -5
        If UpKey() Then MoveObject guy,2
        If DownKey() Then MoveObject guy, -2
        
        'Glue camera to object position
        CloneCameraPosition guy

        'Draw a circle after objects
        'Visualize the center of the world
        DrawGame
        Circle-15,15,30,OFF

        
        DrawScreen

    Until EscapeKey()

    <<TAKAISIN