Empezando a trabajar con los enemigos
This commit is contained in:
10
data/actors/enemies/bug.ani
Normal file
10
data/actors/enemies/bug.ani
Normal file
@@ -0,0 +1,10 @@
|
||||
png_width_in_tiles=6
|
||||
tile_width=16
|
||||
tile_height=16
|
||||
|
||||
[animation]
|
||||
name=walk
|
||||
speed=8
|
||||
loop=yes
|
||||
frames=0,1,2,3,4,5,6
|
||||
[/animation]
|
||||
BIN
data/actors/enemies/bug.png
Normal file
BIN
data/actors/enemies/bug.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
10
data/actors/enemies/flying_eye.ani
Normal file
10
data/actors/enemies/flying_eye.ani
Normal file
@@ -0,0 +1,10 @@
|
||||
png_width_in_tiles=6
|
||||
tile_width=16
|
||||
tile_height=16
|
||||
|
||||
[animation]
|
||||
name=walk
|
||||
speed=8
|
||||
loop=yes
|
||||
frames=0,1,2,3,4,5,6
|
||||
[/animation]
|
||||
BIN
data/actors/enemies/flying_eye.png
Normal file
BIN
data/actors/enemies/flying_eye.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
10
data/actors/enemies/flying_eye_horn.ani
Normal file
10
data/actors/enemies/flying_eye_horn.ani
Normal file
@@ -0,0 +1,10 @@
|
||||
png_width_in_tiles=6
|
||||
tile_width=16
|
||||
tile_height=16
|
||||
|
||||
[animation]
|
||||
name=walk
|
||||
speed=8
|
||||
loop=yes
|
||||
frames=0,1,2,3,4,5,6
|
||||
[/animation]
|
||||
BIN
data/actors/enemies/flying_eye_horn.png
Normal file
BIN
data/actors/enemies/flying_eye_horn.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
10
data/actors/enemies/walking_eye.ani
Normal file
10
data/actors/enemies/walking_eye.ani
Normal file
@@ -0,0 +1,10 @@
|
||||
png_width_in_tiles=6
|
||||
tile_width=16
|
||||
tile_height=16
|
||||
|
||||
[animation]
|
||||
name=walk
|
||||
speed=8
|
||||
loop=yes
|
||||
frames=0,1,2,3,4,5,6
|
||||
[/animation]
|
||||
BIN
data/actors/enemies/walking_eye.png
Normal file
BIN
data/actors/enemies/walking_eye.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.5 KiB |
@@ -132,11 +132,7 @@ bool Map::setVars(std::string var, std::string value)
|
||||
// Indicador de éxito en la asignación
|
||||
bool success = true;
|
||||
|
||||
if (var == "bg_img")
|
||||
{
|
||||
bg_img = value;
|
||||
}
|
||||
else if (var == "tileset_img")
|
||||
if (var == "tileset_img")
|
||||
{
|
||||
tileset_img = value;
|
||||
}
|
||||
@@ -176,10 +172,18 @@ void Map::fillMapTexture()
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
// Dibuja el degradado de fondo
|
||||
for (int i = 0; i < 208; i++)
|
||||
const int num_lines = 208;
|
||||
|
||||
const color_t color1 = {234, 171, 159};
|
||||
const color_t color2 = {144, 225, 231};
|
||||
|
||||
for (int i = 0; i < num_lines; i++)
|
||||
{
|
||||
SDL_SetRenderDrawColor(renderer, 234, 171, 159, 0xFF);
|
||||
SDL_SetRenderDrawColor(renderer, 144, 225, 231, 0xFF);
|
||||
float step = ((float)i / (float)num_lines);
|
||||
int r = color1.r + ((color2.r - color1.r) * step);
|
||||
int g = color1.g + ((color2.g - color1.g) * step);
|
||||
int b = color1.b + ((color2.b - color1.b) * step);
|
||||
SDL_SetRenderDrawColor(renderer, r, g, b, 0xFF);
|
||||
SDL_RenderDrawLine(renderer, 0, i, 320, i);
|
||||
}
|
||||
|
||||
@@ -205,6 +209,7 @@ void Map::fillMapTexture()
|
||||
|
||||
// Dibuja el marco del marcador
|
||||
SDL_SetRenderDrawColor(renderer, 85, 50, 85, 0xFF);
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0xFF);
|
||||
SDL_Rect rect = {0, 208, 320, 32};
|
||||
SDL_RenderDrawRect(renderer, &rect);
|
||||
rect = {1, 209, 318, 30};
|
||||
|
||||
@@ -39,7 +39,6 @@ private:
|
||||
std::string room_left; // Identificador de la habitación que se encuentra a la izquierda
|
||||
std::string room_right; // Identificador de la habitación que se encuentra a la derecha
|
||||
std::string tileset_img; // Imagen con los graficos para la habitación
|
||||
std::string bg_img; // Imagen con los graficos para la habitación
|
||||
std::vector<int> tilemap; // Indice de los tiles a dibujar en la habitación
|
||||
LTexture *texture_tile; // Textura con los graficos de los tiles habitación
|
||||
SDL_Texture *map_texture; // Textura para dibujar el mapa de la habitación
|
||||
|
||||
@@ -82,12 +82,12 @@ void Player::checkInput()
|
||||
if (input->checkInput(INPUT_LEFT, REPEAT_TRUE))
|
||||
{
|
||||
vx = std::max(vx -= accelX, -maxVX);
|
||||
sprite->setFlip(SDL_FLIP_NONE);
|
||||
sprite->setFlip(SDL_FLIP_HORIZONTAL);
|
||||
}
|
||||
else if (input->checkInput(INPUT_RIGHT, REPEAT_TRUE))
|
||||
{
|
||||
vx = std::min(vx += accelX, maxVX);
|
||||
sprite->setFlip(SDL_FLIP_HORIZONTAL);
|
||||
sprite->setFlip(SDL_FLIP_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ Prog::Prog(std::string executablePath)
|
||||
input = new Input(asset->get("gamecontrollerdb.txt"));
|
||||
screen = new Screen(window, renderer, options);
|
||||
|
||||
// Controles
|
||||
// Controles
|
||||
input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
|
||||
input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN);
|
||||
input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
|
||||
@@ -145,11 +145,11 @@ bool Prog::setFileList()
|
||||
asset->add("/data/map/03.map", data);
|
||||
asset->add("/data/map/03.tmx", data);
|
||||
asset->add("/data/map/surface.png", bitmap);
|
||||
|
||||
|
||||
// Ficheros de configuración
|
||||
asset->add("/data/config.bin", data, false);
|
||||
asset->add("/data/input/gamecontrollerdb.txt", data);
|
||||
|
||||
|
||||
// Ficheros del jugador
|
||||
asset->add("/data/player/player.png", bitmap);
|
||||
asset->add("/data/player/player.ani", data);
|
||||
@@ -172,6 +172,16 @@ bool Prog::setFileList()
|
||||
asset->add("/data/font/debug.png", font);
|
||||
asset->add("/data/font/debug.txt", font);
|
||||
|
||||
// Ficheros de enemigos
|
||||
asset->add("/data/actors/enemies/walking_eye.png", bitmap);
|
||||
asset->add("/data/actors/enemies/walking_eye.ani", data);
|
||||
asset->add("/data/actors/enemies/bug.png", bitmap);
|
||||
asset->add("/data/actors/enemies/bug.ani", data);
|
||||
asset->add("/data/actors/enemies/flying_eye.png", bitmap);
|
||||
asset->add("/data/actors/enemies/flying_eye.ani", data);
|
||||
asset->add("/data/actors/enemies/flying_eye_horn.png", bitmap);
|
||||
asset->add("/data/actors/enemies/flying_eye_horn.ani", data);
|
||||
|
||||
return asset->check();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user