add texture player
This commit is contained in:
parent
a9b20ba754
commit
5d7756fa16
4
Makefile
4
Makefile
|
@ -1,10 +1,10 @@
|
||||||
$(shell mkdir -p build)
|
$(shell mkdir -p build)
|
||||||
|
|
||||||
all:
|
all:
|
||||||
gcc main.c -o build/main -lraylib -lm
|
gcc -Wall -Wextra main.c -o build/main -lraylib -lm
|
||||||
|
|
||||||
release:
|
release:
|
||||||
gcc -O3 -DRELEASE main.c -o build/main -lraylib -m
|
gcc -Wall -Wextra -O3 -DRELEASE main.c -o build/main -lraylib -m
|
||||||
|
|
||||||
run: all
|
run: all
|
||||||
./build/main
|
./build/main
|
||||||
|
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 953 B |
12
main.c
12
main.c
|
@ -46,6 +46,7 @@ Rectangle trap = {
|
||||||
.height = trap_len,
|
.height = trap_len,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Texture player_t;
|
||||||
Vec2i player;
|
Vec2i player;
|
||||||
const int player_radius = 25;
|
const int player_radius = 25;
|
||||||
const int player_speed = 5;
|
const int player_speed = 5;
|
||||||
|
@ -171,6 +172,8 @@ void move_map(Vector2 *map, Cardinal direction, const int speed, const float DT)
|
||||||
map->y -= diag_step;
|
map->y -= diag_step;
|
||||||
map->x += diag_step;
|
map->x += diag_step;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,6 +185,7 @@ int main(void)
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
|
|
||||||
player = (Vec2i) {.x = screen.width/2, .y = screen.height/2};
|
player = (Vec2i) {.x = screen.width/2, .y = screen.height/2};
|
||||||
|
player_t = LoadTexture("data/player.png");
|
||||||
map = LoadTexture("data/map2.png");
|
map = LoadTexture("data/map2.png");
|
||||||
map_coord = (Vector2){
|
map_coord = (Vector2){
|
||||||
screen.width/2 - map.width*map_factor/2,
|
screen.width/2 - map.width*map_factor/2,
|
||||||
|
@ -205,7 +209,13 @@ int main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawTextureEx(map, map_coord, 0.0f, map_factor, WHITE);
|
DrawTextureEx(map, map_coord, 0.0f, map_factor, WHITE);
|
||||||
DrawCircle(player.x, player.y, player_radius, BLUE);
|
DrawTexture(
|
||||||
|
player_t,
|
||||||
|
player.x-player_t.width/2,
|
||||||
|
player.y-player_t.height/2,
|
||||||
|
WHITE
|
||||||
|
);
|
||||||
|
|
||||||
// DrawRectangleLinesEx(trap, 1, RED);
|
// DrawRectangleLinesEx(trap, 1, RED);
|
||||||
}
|
}
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
|
|
Loading…
Reference in New Issue