My ECE 2035 final project

Dependencies:   4DGL-uLCD-SE mbed wave_player

Fork of MazeRunner_Fall2017-shell by Eduardo Nava

physics.cpp

Committer:
rconnorlawson
Date:
2017-11-08
Revision:
2:c18c231cb299
Parent:
0:cf4396614a79
Child:
1:2c6ae0fe9a2a

File content as of revision 2:c18c231cb299:

#include "physics.h"
#include "math_extra.h"

void forward_euler(Physics* state, float delta)
{ 
    // TODO: Implement proper forward euler updates for position and velocity
  
    // Compute random motion
    float damp = 0.5;
    float dx = damp*coin_flip();
    float dy = damp*coin_flip();

    // Update position and velocity
    state->px = state->px + dx;
    state->py = state->py + dy;
    state->vx = dx;
    state->vy = dy;
}