This commit is contained in:
felicianoa237
2024-12-23 11:40:58 -06:00
commit 72674393e3
47 changed files with 4013 additions and 0 deletions

46
player_functions.c Normal file
View File

@@ -0,0 +1,46 @@
//
// Created by tony on 11/27/2024.
//
#include <windows.h>
#include <stdbool.h>
#include <stdio.h>
#include "entities.h"
static void getUserInput(struct Entity *pPlayer, SMALL_RECT *pScreenBounds)
{
// Check for specific keyboard keys
if (GetAsyncKeyState(VK_UP))
{
pPlayer->position.Y--;
if (pPlayer->position.Y < pScreenBounds->Top)
{
pPlayer->position.Y++;
}
}
if (GetAsyncKeyState(VK_DOWN))
{
pPlayer->position.Y++;
if (pPlayer->position.Y > pScreenBounds->Bottom)
{
pPlayer->position.Y--;
}
}
if (GetAsyncKeyState(VK_LEFT))
{
pPlayer->position.X--;
if (pPlayer->position.X < pScreenBounds->Left)
{
pPlayer->position.X++;
}
}
if (GetAsyncKeyState(VK_RIGHT))
{
pPlayer->position.X++;
if (pPlayer->position.X > pScreenBounds->Right)
{
pPlayer->position.X--;
}
}
}