Now there is a crappy sprite
This commit is contained in:
+11
-16
@@ -19,11 +19,6 @@ const Point SCREEN_ORIGIN = {0,0};
|
||||
const Size SCREEN_SIZE = {240,320};
|
||||
const Rectangle SCREEN = {SCREEN_ORIGIN,SCREEN_SIZE};
|
||||
|
||||
typedef struct Player_t{
|
||||
Rectangle Hitbox;
|
||||
int HP;
|
||||
}Player;
|
||||
|
||||
Player player;
|
||||
|
||||
void init(void)
|
||||
@@ -107,7 +102,7 @@ void scroll_array(int **array,int **newArray,int width,int height){
|
||||
|
||||
Player CreatePlayer(){
|
||||
int HP = 100;
|
||||
Size playerSize = {15,30};
|
||||
Size playerSize = {32,32};
|
||||
Point position = {SCREEN_SIZE.Width / 2 - playerSize.Width /2,SCREEN_SIZE.Height / 2 - playerSize.Height/2};
|
||||
Rectangle playerHitbox = {position,playerSize};
|
||||
Player player = {playerHitbox,HP};
|
||||
@@ -115,7 +110,7 @@ Player CreatePlayer(){
|
||||
}
|
||||
|
||||
void RefreshPlayer(Point vector){
|
||||
Refresh_Area(player.Hitbox);
|
||||
|
||||
|
||||
player.Hitbox.Position.X += vector.X;
|
||||
player.Hitbox.Position.Y += vector.Y;
|
||||
@@ -128,7 +123,11 @@ void RefreshPlayer(Point vector){
|
||||
if(player.Hitbox.Position.X < 0)
|
||||
player.Hitbox.Position.X = 0;
|
||||
|
||||
DrawPlayer(player.Hitbox);
|
||||
|
||||
Rectangle rect = player.Hitbox;
|
||||
rect.Position = (Point){0,0};
|
||||
DrawPlayer(player,rect);
|
||||
Refresh_Area(player.Hitbox);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
@@ -146,10 +145,9 @@ int main(void) {
|
||||
|
||||
while (true)
|
||||
{
|
||||
int JoystickState = JoystickGetState();
|
||||
|
||||
Point vec = {0,0};
|
||||
int increment = 1;
|
||||
int JoystickState = JoystickGetState();
|
||||
|
||||
if(JoystickState & (1 << 4)){
|
||||
vec.X -= increment;
|
||||
@@ -163,11 +161,6 @@ int main(void) {
|
||||
if(JoystickState & (1 << 1)){
|
||||
vec.Y -= increment;
|
||||
}
|
||||
if(JoystickState & 1){
|
||||
//empty
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(need_to_scroll){
|
||||
scroll(scrolling);
|
||||
@@ -185,7 +178,9 @@ int main(void) {
|
||||
Refresh_Area(areaToRefresh);
|
||||
DrawText(new_origin,newStr,charSize);
|
||||
}
|
||||
RefreshPlayer(vec);
|
||||
|
||||
if(need_to_scroll || vec.X != 0 || vec.Y != 0)
|
||||
RefreshPlayer(vec);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user