59 lines
1.7 KiB
Markdown
59 lines
1.7 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
|
|
|
|
Hold W and S to accelerate the penguin forward and backward. Use A and D to
|
|
change heading direction. This allows you to steer the penguin around the
|
|
environment.
|
|
|
|
Use the arrow keys to change the camera's rotation (pitch and yaw) with respect
|
|
to the penguin, allowing you to look around while the penguin moves.
|
|
|
|
# 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.
|
|
|
|
# Extra Credit
|
|
|
|
The camera moves with the penguin and can be rotated around the penguin using the arrow keys.
|