cs381/as3/README.md

53 lines
1.5 KiB
Markdown

# Building and Running
Clone the repository, navigate to the root of the project, and initialize the
submodules:
```sh
git clone https://github.com/humanoidsandvichdispenser/cs381.git
cd cs381
git submodule update --init --recursive
```
Navigate to the `as3` directory, create a build directory, and run CMake to
generate the build files:
```sh
cd as3
mkdir -p build
cd build
cmake ..
```
Compile the code using `make`:
```sh
make
```
This should create an executable named `as3` in the `build` directory. You can
run the executable with the following command:
```sh
./as3
```
# Instructions on how to use the program
Use W and S to accelerate the penguin forward and backward. Use A and D to
change heading direction. The penguin will only accelerate in the direction
facing and will retain its velocity even when not accelerating or changing
direction.
# Readme Question
`dt` is delta time, which is the time elapsed between each frame, which can be
found by taking the current time and subtracting the time from the previous
frame. Raylib provides a function `GetFrameTime()` that returns the time
elapsed since the last frame, which can be used to calculate `dt`. By using
`dt`, it ensures that physics calculations are independent of frame rate, since
otherwise the velocity would be in terms of units per frame rather than units
per second. By multiplying the velocity by `dt`, it converts the velocity to
units per second, allowing for consistent movement regardless of the frame
rate.