WIP docs: commenting in player.c/player.h and README updates
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
main.c - Done
|
||||
physics.c - Done, refine later
|
||||
physics.h - Done
|
||||
renderer.c - Done
|
||||
renderer.h - Done
|
||||
player.c
|
||||
player.h
|
||||
render.c - Done
|
||||
render.h - Done
|
||||
player.c - Done
|
||||
player.h - Done
|
||||
world.c
|
||||
world.h
|
||||
config.h
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
// let's a go!
|
||||
|
||||
void UpdatePlayerControls(void)
|
||||
{
|
||||
// if there isn't a player, you probably can't do much
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
// if a key pressed, push player to the left
|
||||
if (IsKeyDown(KEY_A))
|
||||
{
|
||||
ApplyForce(
|
||||
@@ -17,7 +21,7 @@ void UpdatePlayerControls(void)
|
||||
(Vector2){-PLAYER_FORCE, 0}
|
||||
);
|
||||
}
|
||||
|
||||
// if d key pressed, push player to the right
|
||||
if (IsKeyDown(KEY_D))
|
||||
{
|
||||
ApplyForce(
|
||||
@@ -25,7 +29,7 @@ void UpdatePlayerControls(void)
|
||||
(Vector2){PLAYER_FORCE, 0}
|
||||
);
|
||||
}
|
||||
|
||||
// if sspace key pressed (and player isn't already jumping), push player upward
|
||||
if (IsGrounded(player) &&
|
||||
IsKeyPressed(KEY_SPACE))
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef PLAYER_H
|
||||
#define PLAYER_H
|
||||
|
||||
// FUNction declaration! yay!!!
|
||||
// run by main.c constantly to allow player input.
|
||||
void UpdatePlayerControls(void);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user