#include "player.h"
#include "graphics.h"
#include "mouse.h"
#include "keyboard.h"
#include "stage.h"
#include "startPage.h"

gxSprite playerSprite;

Player player;

void InitPlayer ()
{
	gxLoadBmp( "Player.tga", &playerSprite, 0 );
	player.health = 100;
	player.X = 0;
	player.Y = 300-32;
}

void UpdatePlayer()
{
    gxDrawSpriteAlpha ( player.X-xAxis, player.Y-yAxis, &playerSprite, 255 );
    // Four keys to allow player movement.

	if(player.health>0)
	{
		if((kbKeyStatus[KB_W] || kbKeyStatus[KB_UP]) && (player.Y>=0))
			player.Y -= 4*startVariables.levelNumber;
		if((kbKeyStatus[KB_S] || kbKeyStatus[KB_DOWN]) && (player.Y<=stages[currentStage].height-64))
			player.Y += 4*startVariables.levelNumber;
		if((kbKeyStatus[KB_A] || kbKeyStatus[KB_LEFT]) && (player.X>=0))
			player.X -= 4*startVariables.levelNumber;
		if((kbKeyStatus[KB_D] || kbKeyStatus[KB_RIGHT]) && (player.X<=stages[currentStage].width-64))
			player.X += 4*startVariables.levelNumber;
	}

}