src/proto2/GameState.cc
author terom
Tue, 18 Nov 2008 18:50:32 +0000
changeset 50 9e1a6506f5a1
parent 26 5685602aeb9c
child 54 b8b043ba0abd
permissions -rw-r--r--
some rough-handed code modifications towards a newer, better, working Physics

#include "GameState.hh"

bool LocalPlayer::handleMove (PlayerInput_Move input) {
    int dx = 0, dy = 0;

    // handle up/down/left/right
    if (input & MOVE_UP)
            dy -= 3;
    
    if (input & MOVE_DOWN)
            dy += 3;

    if (input & MOVE_LEFT)
            dx -= 3;

    if (input & MOVE_RIGHT)
            dx += 3;
    
    // apply force
    applyForce(Vector(dx, dy));
}