Compare commits
6 Commits
v0.1.0
...
dc91ef4140
| Author | SHA1 | Date | |
|---|---|---|---|
| dc91ef4140 | |||
| 4ed9fd07a2 | |||
| ec29a2362b | |||
| 067ef4b6e4 | |||
| ddc3a0b9b0 | |||
| 87eebe730d |
@@ -1,7 +1,7 @@
|
|||||||
# CMakeLists.txt
|
# CMakeLists.txt
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(pollo VERSION 0.1.0)
|
project(pollo VERSION 0.1.1)
|
||||||
|
|
||||||
# Info del proyecto para version.h
|
# Info del proyecto para version.h
|
||||||
set(PROJECT_LONG_NAME "Los pollos hermanos")
|
set(PROJECT_LONG_NAME "Los pollos hermanos")
|
||||||
|
|||||||
7
Makefile
7
Makefile
@@ -451,7 +451,6 @@ rpi_release:
|
|||||||
CROSS_CXX := x86_64-w64-mingw32-g++
|
CROSS_CXX := x86_64-w64-mingw32-g++
|
||||||
CROSS_STRIP := x86_64-w64-mingw32-strip
|
CROSS_STRIP := x86_64-w64-mingw32-strip
|
||||||
CROSS_WINDRES := x86_64-w64-mingw32-windres
|
CROSS_WINDRES := x86_64-w64-mingw32-windres
|
||||||
CROSS_ZIP_FILE := $(TARGET_NAME)-$(VERSION)-win32-x64.zip
|
|
||||||
|
|
||||||
CROSS_CXXFLAGS := -std=$(CPP_STANDARD) -Wall -Os -ffunction-sections -fdata-sections \
|
CROSS_CXXFLAGS := -std=$(CPP_STANDARD) -Wall -Os -ffunction-sections -fdata-sections \
|
||||||
-Wl,--gc-sections -static-libstdc++ -static-libgcc \
|
-Wl,--gc-sections -static-libstdc++ -static-libgcc \
|
||||||
@@ -504,10 +503,10 @@ windows_cross:
|
|||||||
$(CROSS_STRIP) -s "$(RELEASE_FOLDER)/$(APP_NAME).exe"
|
$(CROSS_STRIP) -s "$(RELEASE_FOLDER)/$(APP_NAME).exe"
|
||||||
|
|
||||||
# 6. Empaquetar
|
# 6. Empaquetar
|
||||||
@echo "Empaquetando en $(CROSS_ZIP_FILE)..."
|
@echo "Empaquetando en $(WINDOWS_RELEASE)..."
|
||||||
cd $(RELEASE_FOLDER) && zip -r ../$(CROSS_ZIP_FILE) .
|
cd $(RELEASE_FOLDER) && zip -r ../$(WINDOWS_RELEASE) .
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
@echo "✓ Release de Windows (Cross) completado: $(CROSS_ZIP_FILE)"
|
@echo "✓ Release de Windows (Cross) completado: $(WINDOWS_RELEASE)"
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SETUP
|
# SETUP
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ assets:
|
|||||||
rooms:
|
rooms:
|
||||||
- type: ROOM
|
- type: ROOM
|
||||||
path: ${PREFIX}/data/room/03.yaml
|
path: ${PREFIX}/data/room/03.yaml
|
||||||
|
- type: ROOM
|
||||||
|
path: ${PREFIX}/data/room/04.yaml
|
||||||
|
|
||||||
# TILESETS
|
# TILESETS
|
||||||
tilesets:
|
tilesets:
|
||||||
@@ -69,14 +71,6 @@ assets:
|
|||||||
path: ${PREFIX}/data/player/player.gif
|
path: ${PREFIX}/data/player/player.gif
|
||||||
- type: ANIMATION
|
- type: ANIMATION
|
||||||
path: ${PREFIX}/data/player/player.yaml
|
path: ${PREFIX}/data/player/player.yaml
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/player/player2.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/player/player2.yaml
|
|
||||||
- type: BITMAP
|
|
||||||
path: ${PREFIX}/data/player/player_game_over.gif
|
|
||||||
- type: ANIMATION
|
|
||||||
path: ${PREFIX}/data/player/player_game_over.yaml
|
|
||||||
|
|
||||||
# MUSIC
|
# MUSIC
|
||||||
music:
|
music:
|
||||||
@@ -84,16 +78,6 @@ assets:
|
|||||||
path: ${PREFIX}/data/music/574070_KUVO_Farewell_to_school.ogg
|
path: ${PREFIX}/data/music/574070_KUVO_Farewell_to_school.ogg
|
||||||
- type: MUSIC
|
- type: MUSIC
|
||||||
path: ${PREFIX}/data/music/574071_EA_DTV.ogg
|
path: ${PREFIX}/data/music/574071_EA_DTV.ogg
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/574072_Scalesmann_Kaleidoscope.ogg
|
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/574073_KUVO_We_are_us.ogg
|
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/574219_nq_core_vet.ogg
|
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/575111_nq_Zak_McDrucken.ogg
|
|
||||||
- type: MUSIC
|
|
||||||
path: ${PREFIX}/data/music/576109_Pator_Parallel_Visions.ogg
|
|
||||||
|
|
||||||
# SOUNDS
|
# SOUNDS
|
||||||
sounds:
|
sounds:
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 223 B |
@@ -1,20 +0,0 @@
|
|||||||
# player2 animation
|
|
||||||
tileSetFile: player2.gif
|
|
||||||
frameWidth: 8
|
|
||||||
frameHeight: 16
|
|
||||||
|
|
||||||
animations:
|
|
||||||
- name: stand
|
|
||||||
speed: 0.1333
|
|
||||||
loop: 0
|
|
||||||
frames: [0]
|
|
||||||
|
|
||||||
- name: walk
|
|
||||||
speed: 0.1333
|
|
||||||
loop: 0
|
|
||||||
frames: [0, 1, 2, 3, 4, 5, 6, 7]
|
|
||||||
|
|
||||||
- name: walk_menu
|
|
||||||
speed: 0.0
|
|
||||||
loop: 0
|
|
||||||
frames: [0, 1, 2, 3, 4, 5, 6, 7]
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 225 B |
@@ -1,10 +0,0 @@
|
|||||||
# player_game_over animation
|
|
||||||
tileSetFile: player_game_over.gif
|
|
||||||
frameWidth: 19
|
|
||||||
frameHeight: 18
|
|
||||||
|
|
||||||
animations:
|
|
||||||
- name: default
|
|
||||||
speed: 0.1
|
|
||||||
loop: 0
|
|
||||||
frames: [0, 1, 2, 3]
|
|
||||||
53
data/room/04.tmx
Normal file
53
data/room/04.tmx
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<map version="1.10" tiledversion="1.11.2" orientation="orthogonal" renderorder="right-down" width="40" height="20" tilewidth="8" tileheight="8" infinite="0" nextlayerid="3" nextobjectid="1">
|
||||||
|
<tileset firstgid="1" source="//wsl.localhost/Debian/home/sergio/gitea/pollo/data/tilesets/standard.tsx"/>
|
||||||
|
<tileset firstgid="577" source="//wsl.localhost/Debian/home/sergio/gitea/pollo/data/tilesets/walls.tsx"/>
|
||||||
|
<layer id="1" name="Capa de patrones 1" width="40" height="20">
|
||||||
|
<data encoding="csv">
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,34,34,0,0,0,0,0,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,142,0,0,0,0,0,0,34,0,0,0,0,0,0,
|
||||||
|
34,0,0,0,0,0,0,0,0,71,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,0,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,34,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,31,31,31,31,31,31,31,31,31,31,34,0,71,72,0,0,34,
|
||||||
|
34,31,31,31,31,31,31,31,31,31,31,31,31,0,0,0,0,0,0,0,0,0,0,260,0,0,0,0,0,0,260,0,0,34,0,95,96,0,0,34,
|
||||||
|
34,31,31,31,31,31,31,31,31,31,31,31,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,0,34,
|
||||||
|
34,31,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,
|
||||||
|
34,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,142,0,0,0,0,0,0,0,0,0,0,34,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,142,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,365,365,365,365,365,365,365,365,365,34,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,175,175,175,175,0,0,0,0,0,0,293,293,293,293,293,293,293,293,293,34,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,263,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,
|
||||||
|
34,367,367,367,367,367,367,367,367,367,367,367,367,367,367,0,0,0,0,0,0,287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134,
|
||||||
|
34,295,295,295,295,295,295,295,295,295,295,295,295,295,295,0,0,0,0,0,0,287,0,0,0,0,0,0,0,142,0,0,0,0,0,0,0,0,0,134,
|
||||||
|
34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,
|
||||||
|
34,0,0,0,0,381,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,311,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,
|
||||||
|
34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
<layer id="2" name="Capa de patrones 2" width="40" height="20">
|
||||||
|
<data encoding="csv">
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,577,577,0,0,0,0,0,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,578,578,578,578,578,578,578,578,578,578,578,577,0,0,0,0,0,577,
|
||||||
|
577,577,577,577,577,577,577,577,577,577,577,577,577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,0,0,0,0,0,577,
|
||||||
|
577,577,577,577,577,577,577,577,577,577,577,577,577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,0,0,0,0,0,577,
|
||||||
|
577,577,577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,578,578,578,578,578,578,578,578,578,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,578,578,578,578,578,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,578,578,578,578,578,578,578,578,578,578,578,578,578,578,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,577,
|
||||||
|
577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577,577
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
</map>
|
||||||
85
data/room/04.yaml
Normal file
85
data/room/04.yaml
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# VOID MAIN
|
||||||
|
room:
|
||||||
|
name: "VOID MAIN"
|
||||||
|
bgColor: blue
|
||||||
|
border: mauve
|
||||||
|
tileSetFile: standard.gif
|
||||||
|
|
||||||
|
# Conexiones de la habitación (null = sin conexión)
|
||||||
|
connections:
|
||||||
|
up: null
|
||||||
|
down: null
|
||||||
|
left: null
|
||||||
|
right: null
|
||||||
|
|
||||||
|
# Colores de los objetos
|
||||||
|
itemColor1: magenta
|
||||||
|
itemColor2: pastel_magenta
|
||||||
|
|
||||||
|
# Dirección de la cinta transportadora: left, none, right
|
||||||
|
conveyorBelt: left
|
||||||
|
|
||||||
|
# Tilemap: 20 filas x 40 columnas (320x160 pixeles @ 8px/tile)
|
||||||
|
# Indices de tiles (-1 = vacio)
|
||||||
|
tilemap:
|
||||||
|
- [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 33, 33, -1, -1, -1, -1, -1]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 33, -1, 70, 71, -1, -1, 33]
|
||||||
|
- [33, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 259, -1, -1, -1, -1, -1, -1, 259, -1, -1, 33, -1, 94, 95, -1, -1, 33]
|
||||||
|
- [33, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, 30, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 364, 364, 364, 364, 364, 364, 364, 364, 364, 33]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, 174, 174, 174, 174, -1, -1, -1, -1, -1, -1, 292, 292, 292, 292, 292, 292, 292, 292, 292, 33]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 286, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, -1, -1, -1, -1, -1, -1, 286, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133]
|
||||||
|
- [33, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, -1, -1, -1, -1, -1, -1, 286, -1, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133]
|
||||||
|
- [33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 286, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, -1, -1, -1, -1, 380, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33]
|
||||||
|
- [33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33]
|
||||||
|
|
||||||
|
# Collisionmap: 20 filas x 40 columnas
|
||||||
|
# Indices de colision (-1 = vacio, 1 = solido, 2 = plataforma)
|
||||||
|
collisionmap:
|
||||||
|
- [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1]
|
||||||
|
- [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
||||||
|
|
||||||
|
# Enemigos en esta habitación
|
||||||
|
enemies:
|
||||||
|
- animation: code.yaml
|
||||||
|
position: {x: 1, y: 17}
|
||||||
|
velocity: {x: 24.0, y: 0}
|
||||||
|
boundaries:
|
||||||
|
position1: {x: 1, y: 17}
|
||||||
|
position2: {x: 16, y: 17}
|
||||||
|
color: yellow
|
||||||
|
|
||||||
|
# Objetos en esta habitación
|
||||||
|
items:
|
||||||
|
- tileSetFile: items.gif
|
||||||
|
tile: 42
|
||||||
|
position: {x: 25, y: 7}
|
||||||
|
counter: 1
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 9.0 KiB |
@@ -182,8 +182,6 @@ auto Director::checkProgramArguments(std::vector<std::string> const& args) -> st
|
|||||||
Options::cheats.infinite_lives = Options::Cheat::State::ENABLED;
|
Options::cheats.infinite_lives = Options::Cheat::State::ENABLED;
|
||||||
} else if (argument == "--invincible") {
|
} else if (argument == "--invincible") {
|
||||||
Options::cheats.invincible = Options::Cheat::State::ENABLED;
|
Options::cheats.invincible = Options::Cheat::State::ENABLED;
|
||||||
} else if (argument == "--jailEnabled") {
|
|
||||||
Options::cheats.jail_is_open = Options::Cheat::State::ENABLED;
|
|
||||||
} else if (argument == "--altSkin") {
|
} else if (argument == "--altSkin") {
|
||||||
Options::cheats.alternate_skin = Options::Cheat::State::ENABLED;
|
Options::cheats.alternate_skin = Options::Cheat::State::ENABLED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Defaults {
|
|||||||
// Dimensiones del canvas del juego (usa GameCanvas como fuente única)
|
// Dimensiones del canvas del juego (usa GameCanvas como fuente única)
|
||||||
namespace Canvas {
|
namespace Canvas {
|
||||||
constexpr int WIDTH = GameCanvas::WIDTH; // Ancho del canvas del juego (320)
|
constexpr int WIDTH = GameCanvas::WIDTH; // Ancho del canvas del juego (320)
|
||||||
constexpr int HEIGHT = GameCanvas::HEIGHT; // Alto del canvas del juego (240)
|
constexpr int HEIGHT = GameCanvas::HEIGHT; // Alto del canvas del juego (200)
|
||||||
} // namespace Canvas
|
} // namespace Canvas
|
||||||
|
|
||||||
// --- WINDOW ---
|
// --- WINDOW ---
|
||||||
@@ -39,8 +39,8 @@ constexpr const char* PALETTE_NAME = "cpc"; // Paleta por defect
|
|||||||
// --- BORDER ---
|
// --- BORDER ---
|
||||||
namespace Border {
|
namespace Border {
|
||||||
constexpr bool ENABLED = true; // Borde activado por defecto
|
constexpr bool ENABLED = true; // Borde activado por defecto
|
||||||
constexpr int WIDTH = 32; // Ancho del borde por defecto
|
constexpr int WIDTH = 40; // Ancho del borde por defecto (400x300 total)
|
||||||
constexpr int HEIGHT = 24; // Alto del borde por defecto
|
constexpr int HEIGHT = 50; // Alto del borde por defecto (400x300 total)
|
||||||
} // namespace Border
|
} // namespace Border
|
||||||
|
|
||||||
// --- AUDIO ---
|
// --- AUDIO ---
|
||||||
@@ -73,7 +73,6 @@ constexpr const char* NOTIFY = "notify.wav"; // Sonido de notificación
|
|||||||
namespace Cheat {
|
namespace Cheat {
|
||||||
constexpr bool INFINITE_LIVES = false; // Vidas infinitas desactivadas por defecto
|
constexpr bool INFINITE_LIVES = false; // Vidas infinitas desactivadas por defecto
|
||||||
constexpr bool INVINCIBLE = false; // Invencibilidad desactivada por defecto
|
constexpr bool INVINCIBLE = false; // Invencibilidad desactivada por defecto
|
||||||
constexpr bool JAIL_IS_OPEN = false; // Jail abierta desactivada por defecto
|
|
||||||
constexpr bool ALTERNATE_SKIN = false; // Skin alternativa desactivada por defecto
|
constexpr bool ALTERNATE_SKIN = false; // Skin alternativa desactivada por defecto
|
||||||
} // namespace Cheat
|
} // namespace Cheat
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
class Player {
|
class Player {
|
||||||
public:
|
public:
|
||||||
|
// --- Constantes de tamaño ---
|
||||||
|
static constexpr int WIDTH = 8; // Ancho del jugador en pixels
|
||||||
|
static constexpr int HEIGHT = 16; // Alto del jugador en pixels
|
||||||
|
|
||||||
// --- Enums y Structs ---
|
// --- Enums y Structs ---
|
||||||
enum class State {
|
enum class State {
|
||||||
ON_GROUND, // En suelo plano o conveyor belt
|
ON_GROUND, // En suelo plano o conveyor belt
|
||||||
@@ -72,10 +76,6 @@ class Player {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// --- Constantes de tamaño ---
|
|
||||||
static constexpr int WIDTH = 8; // Ancho del jugador en pixels
|
|
||||||
static constexpr int HEIGHT = 16; // Alto del jugador en pixels
|
|
||||||
|
|
||||||
// --- Constantes de movimiento horizontal ---
|
// --- Constantes de movimiento horizontal ---
|
||||||
static constexpr float WALK_VELOCITY = 50.0F; // Velocidad al caminar (inmediata) en pixels/segundo
|
static constexpr float WALK_VELOCITY = 50.0F; // Velocidad al caminar (inmediata) en pixels/segundo
|
||||||
static constexpr float RUN_VELOCITY = 80.0F; // Velocidad al correr en pixels/segundo
|
static constexpr float RUN_VELOCITY = 80.0F; // Velocidad al correr en pixels/segundo
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ Room::Room(const std::string& room_path, std::shared_ptr<Scoreboard::Data> data)
|
|||||||
item_manager_ = std::make_unique<ItemManager>(room->name, data_);
|
item_manager_ = std::make_unique<ItemManager>(room->name, data_);
|
||||||
|
|
||||||
initializeRoom(*room);
|
initializeRoom(*room);
|
||||||
openTheJail(); // Abre la Jail si se da el caso
|
|
||||||
|
|
||||||
// Crea el mapa de colisiones (necesita collision_data_, conveyor_belt_direction_)
|
// Crea el mapa de colisiones (necesita collision_data_, conveyor_belt_direction_)
|
||||||
collision_map_ = std::make_unique<CollisionMap>(collision_data_, conveyor_belt_direction_);
|
collision_map_ = std::make_unique<CollisionMap>(collision_data_, conveyor_belt_direction_);
|
||||||
@@ -81,28 +80,6 @@ void Room::initializeRoom(const Data& room) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abre la jail para poder entrar
|
|
||||||
void Room::openTheJail() {
|
|
||||||
if (data_->jail_is_open && name_ == "THE JAIL") {
|
|
||||||
// Elimina el último enemigo (Bry debe ser el último enemigo definido en el fichero)
|
|
||||||
if (!enemy_manager_->isEmpty()) {
|
|
||||||
enemy_manager_->removeLastEnemy();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Abre las puertas (tanto en tilemap para renderizado como en collisionmap para colisiones)
|
|
||||||
constexpr int TILE_A = 16 + (13 * MAP_WIDTH);
|
|
||||||
constexpr int TILE_B = 16 + (14 * MAP_WIDTH);
|
|
||||||
if (TILE_A < tile_map_.size()) {
|
|
||||||
tile_map_[TILE_A] = -1; // Renderizado: vacío
|
|
||||||
collision_data_[TILE_A] = -1; // Colisiones: vacío
|
|
||||||
}
|
|
||||||
if (TILE_B < tile_map_.size()) {
|
|
||||||
tile_map_[TILE_B] = -1; // Renderizado: vacío
|
|
||||||
collision_data_[TILE_B] = -1; // Colisiones: vacío
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dibuja el mapa en pantalla
|
// Dibuja el mapa en pantalla
|
||||||
void Room::renderMap() {
|
void Room::renderMap() {
|
||||||
tilemap_renderer_->render();
|
tilemap_renderer_->render();
|
||||||
|
|||||||
@@ -124,5 +124,4 @@ class Room {
|
|||||||
|
|
||||||
// --- Funciones ---
|
// --- Funciones ---
|
||||||
void initializeRoom(const Data& room); // Inicializa los valores
|
void initializeRoom(const Data& room); // Inicializa los valores
|
||||||
void openTheJail(); // Abre la jail para poder entrar
|
|
||||||
};
|
};
|
||||||
@@ -41,7 +41,7 @@ class RoomLoader {
|
|||||||
*
|
*
|
||||||
* El formato YAML esperado incluye:
|
* El formato YAML esperado incluye:
|
||||||
* - room: configuración general
|
* - room: configuración general
|
||||||
* - tilemap: array 2D de 24x40 tiles (convertido a vector 1D de 960 elementos)
|
* - tilemap: array 2D de 20x40 tiles (convertido a vector 1D de 800 elementos)
|
||||||
* - enemies: lista de enemigos (opcional)
|
* - enemies: lista de enemigos (opcional)
|
||||||
* - items: lista de items (opcional)
|
* - items: lista de items (opcional)
|
||||||
*/
|
*/
|
||||||
@@ -64,8 +64,8 @@ class RoomLoader {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Convierte un tilemap 2D a vector 1D flat
|
* @brief Convierte un tilemap 2D a vector 1D flat
|
||||||
* @param tilemap_2d Array 2D de tiles (24 rows × 40 cols)
|
* @param tilemap_2d Array 2D de tiles (20 rows × 40 cols)
|
||||||
* @return Vector 1D flat con 960 elementos
|
* @return Vector 1D flat con 800 elementos
|
||||||
*/
|
*/
|
||||||
static auto flattenTilemap(const std::vector<std::vector<int>>& tilemap_2d) -> std::vector<int>;
|
static auto flattenTilemap(const std::vector<std::vector<int>>& tilemap_2d) -> std::vector<int>;
|
||||||
|
|
||||||
|
|||||||
@@ -96,23 +96,8 @@ void Scoreboard::setPaused(bool value) {
|
|||||||
|
|
||||||
// Actualiza el color de la cantidad de items recogidos
|
// Actualiza el color de la cantidad de items recogidos
|
||||||
void Scoreboard::updateItemsColor(float delta_time) {
|
void Scoreboard::updateItemsColor(float delta_time) {
|
||||||
if (!data_->jail_is_open) {
|
// No hay animación de color de items en este juego
|
||||||
return;
|
items_color_ = stringToColor("white");
|
||||||
}
|
|
||||||
|
|
||||||
items_color_timer_ += delta_time;
|
|
||||||
|
|
||||||
// Resetear timer cada 2 ciclos (0.666s total)
|
|
||||||
if (items_color_timer_ >= ITEMS_COLOR_BLINK_DURATION * 2.0F) {
|
|
||||||
items_color_timer_ = 0.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alternar color cada ITEMS_COLOR_BLINK_DURATION
|
|
||||||
if (items_color_timer_ < ITEMS_COLOR_BLINK_DURATION) {
|
|
||||||
items_color_ = stringToColor("white");
|
|
||||||
} else {
|
|
||||||
items_color_ = stringToColor("magenta");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Devuelve la cantidad de minutos de juego transcurridos
|
// Devuelve la cantidad de minutos de juego transcurridos
|
||||||
@@ -129,9 +114,9 @@ void Scoreboard::fillTexture() {
|
|||||||
// Limpia la textura
|
// Limpia la textura
|
||||||
surface_->clear(stringToColor("black"));
|
surface_->clear(stringToColor("black"));
|
||||||
|
|
||||||
// Anclas
|
// Anclas (ajustadas para scoreboard de 40px)
|
||||||
constexpr int LINE1 = Tile::SIZE;
|
constexpr int LINE1 = 6; // Reducido de 8 para ajuste proporcional
|
||||||
constexpr int LINE2 = 3 * Tile::SIZE;
|
constexpr int LINE2 = 20; // Reducido de 24 para ajuste proporcional
|
||||||
|
|
||||||
// Dibuja las vidas
|
// Dibuja las vidas
|
||||||
// Calcular desplazamiento basado en tiempo
|
// Calcular desplazamiento basado en tiempo
|
||||||
|
|||||||
@@ -13,13 +13,12 @@ class Scoreboard {
|
|||||||
public:
|
public:
|
||||||
// Tipos anidados
|
// Tipos anidados
|
||||||
struct Data {
|
struct Data {
|
||||||
int items{0}; // Lleva la cuenta de los objetos recogidos
|
int items{0}; // Lleva la cuenta de los objetos recogidos
|
||||||
int lives{0}; // Lleva la cuenta de las vidas restantes del jugador
|
int lives{0}; // Lleva la cuenta de las vidas restantes del jugador
|
||||||
int rooms{0}; // Lleva la cuenta de las habitaciones visitadas
|
int rooms{0}; // Lleva la cuenta de las habitaciones visitadas
|
||||||
bool music{true}; // Indica si ha de sonar la música durante el juego
|
bool music{true}; // Indica si ha de sonar la música durante el juego
|
||||||
Uint8 color{0}; // Color para escribir el texto del marcador
|
Uint8 color{0}; // Color para escribir el texto del marcador
|
||||||
Uint32 ini_clock{0}; // Tiempo inicial para calcular el tiempo transcurrido
|
Uint32 ini_clock{0}; // Tiempo inicial para calcular el tiempo transcurrido
|
||||||
bool jail_is_open{false}; // Indica si se puede entrar a la Jail
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Métodos públicos
|
// Métodos públicos
|
||||||
|
|||||||
@@ -38,12 +38,11 @@ struct Cheat {
|
|||||||
|
|
||||||
State infinite_lives{Defaults::Cheat::INFINITE_LIVES ? State::ENABLED : State::DISABLED}; // Indica si el jugador dispone de vidas infinitas
|
State infinite_lives{Defaults::Cheat::INFINITE_LIVES ? State::ENABLED : State::DISABLED}; // Indica si el jugador dispone de vidas infinitas
|
||||||
State invincible{Defaults::Cheat::INVINCIBLE ? State::ENABLED : State::DISABLED}; // Indica si el jugador puede morir
|
State invincible{Defaults::Cheat::INVINCIBLE ? State::ENABLED : State::DISABLED}; // Indica si el jugador puede morir
|
||||||
State jail_is_open{Defaults::Cheat::JAIL_IS_OPEN ? State::ENABLED : State::DISABLED}; // Indica si la Jail está abierta
|
|
||||||
State alternate_skin{Defaults::Cheat::ALTERNATE_SKIN ? State::ENABLED : State::DISABLED}; // Indica si se usa una skin diferente para el jugador
|
State alternate_skin{Defaults::Cheat::ALTERNATE_SKIN ? State::ENABLED : State::DISABLED}; // Indica si se usa una skin diferente para el jugador
|
||||||
|
|
||||||
// Método para comprobar si alguno de los tres primeros trucos está activo
|
// Método para comprobar si alguno de los trucos está activo
|
||||||
[[nodiscard]] auto enabled() const -> bool {
|
[[nodiscard]] auto enabled() const -> bool {
|
||||||
return infinite_lives == State::ENABLED || invincible == State::ENABLED || jail_is_open == State::ENABLED;
|
return infinite_lives == State::ENABLED || invincible == State::ENABLED;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,16 +33,16 @@
|
|||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Game::Game(Mode mode)
|
Game::Game(Mode mode)
|
||||||
: scoreboard_data_(std::make_shared<Scoreboard::Data>(0, 9, 0, true, 0, SDL_GetTicks(), Options::cheats.jail_is_open == Options::Cheat::State::ENABLED)),
|
: scoreboard_data_(std::make_shared<Scoreboard::Data>(0, 9, 0, true, 0, SDL_GetTicks())),
|
||||||
scoreboard_(std::make_shared<Scoreboard>(scoreboard_data_)),
|
scoreboard_(std::make_shared<Scoreboard>(scoreboard_data_)),
|
||||||
room_tracker_(std::make_shared<RoomTracker>()),
|
room_tracker_(std::make_shared<RoomTracker>()),
|
||||||
mode_(mode),
|
mode_(mode),
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
current_room_("03.yaml"),
|
current_room_("04.yaml"),
|
||||||
spawn_data_(Player::SpawnData(25 * Tile::SIZE, 21 * Tile::SIZE, 0, 0, 0, Player::State::ON_GROUND, Flip::LEFT))
|
spawn_data_(Player::SpawnData(25 * Tile::SIZE, PlayArea::BOTTOM - Player::HEIGHT - Tile::SIZE, 0, 0, 0, Player::State::ON_GROUND, Flip::LEFT))
|
||||||
#else
|
#else
|
||||||
current_room_("03.yaml"),
|
current_room_("04.yaml"),
|
||||||
spawn_data_(Player::SpawnData(25 * Tile::SIZE, 13 * Tile::SIZE, 0, 0, 0, Player::State::ON_GROUND, Flip::LEFT))
|
spawn_data_(Player::SpawnData(25 * Tile::SIZE, 21 * Tile::SIZE, 0, 0, 0, Player::State::ON_GROUND, Flip::LEFT))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// Crea objetos e inicializa variables
|
// Crea objetos e inicializa variables
|
||||||
@@ -173,12 +173,12 @@ void Game::updatePlaying(float delta_time) {
|
|||||||
#else
|
#else
|
||||||
player_->update(delta_time);
|
player_->update(delta_time);
|
||||||
#endif
|
#endif
|
||||||
checkPlayerIsOnBorder();
|
handlePlayerIsOnBorder();
|
||||||
checkPlayerAndItems();
|
handlePlayerAndItemsCollisions();
|
||||||
checkPlayerAndEnemies();
|
handlePlayerAndEnemiesCollisions();
|
||||||
checkIfPlayerIsAlive();
|
handleIfPlayerIsAlive();
|
||||||
checkEndGame();
|
isGameCompleted();
|
||||||
checkRestoringJail(delta_time);
|
restAtJail(delta_time);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Mode::DEMO:
|
case Mode::DEMO:
|
||||||
@@ -450,11 +450,6 @@ void Game::handleDebugEvents(const SDL_Event& event) {
|
|||||||
player_->setColor();
|
player_->setColor();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDLK_3:
|
|
||||||
Options::cheats.jail_is_open = Options::cheats.jail_is_open == Options::Cheat::State::ENABLED ? Options::Cheat::State::DISABLED : Options::Cheat::State::ENABLED;
|
|
||||||
Notifier::get()->show({std::string("JAIL IS OPEN ") + (Options::cheats.jail_is_open == Options::Cheat::State::ENABLED ? "ENABLED" : "DISABLED")}, Notifier::Style::DEFAULT, -1, true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SDLK_0:
|
case SDLK_0:
|
||||||
Screen::get()->toggleDebugInfo();
|
Screen::get()->toggleDebugInfo();
|
||||||
break;
|
break;
|
||||||
@@ -581,7 +576,7 @@ auto Game::changeRoom(const std::string& room_path) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si el jugador esta en el borde de la pantalla
|
// Comprueba si el jugador esta en el borde de la pantalla
|
||||||
void Game::checkPlayerIsOnBorder() {
|
void Game::handlePlayerIsOnBorder() {
|
||||||
if (player_->isOnBorder()) {
|
if (player_->isOnBorder()) {
|
||||||
const auto BORDER = player_->getBorder();
|
const auto BORDER = player_->getBorder();
|
||||||
const auto ROOM_NAME = room_->getRoom(BORDER);
|
const auto ROOM_NAME = room_->getRoom(BORDER);
|
||||||
@@ -602,7 +597,7 @@ void Game::checkPlayerIsOnBorder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba las colisiones del jugador con los enemigos
|
// Comprueba las colisiones del jugador con los enemigos
|
||||||
auto Game::checkPlayerAndEnemies() -> bool {
|
auto Game::handlePlayerAndEnemiesCollisions() -> bool {
|
||||||
const bool DEATH = room_->enemyCollision(player_->getCollider());
|
const bool DEATH = room_->enemyCollision(player_->getCollider());
|
||||||
if (DEATH) {
|
if (DEATH) {
|
||||||
killPlayer();
|
killPlayer();
|
||||||
@@ -611,12 +606,12 @@ auto Game::checkPlayerAndEnemies() -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba las colisiones del jugador con los objetos
|
// Comprueba las colisiones del jugador con los objetos
|
||||||
void Game::checkPlayerAndItems() {
|
void Game::handlePlayerAndItemsCollisions() {
|
||||||
room_->itemCollision(player_->getCollider());
|
room_->itemCollision(player_->getCollider());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si el jugador esta vivo
|
// Comprueba si el jugador esta vivo
|
||||||
void Game::checkIfPlayerIsAlive() {
|
void Game::handleIfPlayerIsAlive() {
|
||||||
if (!player_->isAlive()) {
|
if (!player_->isAlive()) {
|
||||||
killPlayer();
|
killPlayer();
|
||||||
}
|
}
|
||||||
@@ -652,12 +647,10 @@ void Game::setScoreBoardColor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Comprueba si ha finalizado el juego
|
// Comprueba si ha finalizado el juego
|
||||||
auto Game::checkEndGame() -> bool {
|
auto Game::isGameCompleted() -> bool {
|
||||||
const bool IS_ON_THE_ROOM = room_->getName() == "THE JAIL"; // Estar en la habitación que toca
|
const bool IS_ON_THE_ROOM = room_->getName() == "THE JAIL"; // Estar en la habitación que toca
|
||||||
const bool HAVE_THE_ITEMS = scoreboard_data_->items >= int(total_items_ * 0.9F) || Options::cheats.jail_is_open == Options::Cheat::State::ENABLED; // Con mas del 90% de los items recogidos
|
const bool HAVE_THE_ITEMS = scoreboard_data_->items >= int(total_items_ * 0.9F); // Con mas del 90% de los items recogidos
|
||||||
const bool IS_ON_THE_DOOR = player_->getRect().x <= 128; // Y en la ubicación que toca (En la puerta)
|
const bool IS_ON_THE_DOOR = player_->getRect().x <= 128; // Y en la ubicación que toca (En la puerta)
|
||||||
|
|
||||||
scoreboard_data_->jail_is_open = HAVE_THE_ITEMS;
|
|
||||||
|
|
||||||
if (HAVE_THE_ITEMS && IS_ON_THE_ROOM && IS_ON_THE_DOOR) {
|
if (HAVE_THE_ITEMS && IS_ON_THE_ROOM && IS_ON_THE_DOOR) {
|
||||||
// Iniciar transición de fade en vez de cambio inmediato de escena
|
// Iniciar transición de fade en vez de cambio inmediato de escena
|
||||||
@@ -691,7 +684,7 @@ void Game::togglePause() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Da vidas al jugador cuando está en la Jail
|
// Da vidas al jugador cuando está en la Jail
|
||||||
void Game::checkRestoringJail(float delta_time) {
|
void Game::restAtJail(float delta_time) {
|
||||||
if (room_->getName() != "THE JAIL" || scoreboard_data_->lives == 9) {
|
if (room_->getName() != "THE JAIL" || scoreboard_data_->lives == 9) {
|
||||||
jail_restore_time_ = 0.0F; // Reset timer cuando no está en la Jail
|
jail_restore_time_ = 0.0F; // Reset timer cuando no está en la Jail
|
||||||
return;
|
return;
|
||||||
@@ -728,8 +721,7 @@ void Game::fillRoomNameTexture() {
|
|||||||
|
|
||||||
// Inicializa al jugador
|
// Inicializa al jugador
|
||||||
void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room> room) {
|
void Game::initPlayer(const Player::SpawnData& spawn_point, std::shared_ptr<Room> room) {
|
||||||
std::string player_animations = Options::cheats.alternate_skin == Options::Cheat::State::ENABLED ? "player2.yaml" : "player.yaml";
|
const Player::Data PLAYER{.spawn_data = spawn_point, .animations_path = "player.yaml", .room = std::move(room)};
|
||||||
const Player::Data PLAYER{.spawn_data = spawn_point, .animations_path = player_animations, .room = std::move(room)};
|
|
||||||
player_ = std::make_shared<Player>(PLAYER);
|
player_ = std::make_shared<Player>(PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,16 +71,16 @@ class Game {
|
|||||||
void renderPostFadeEnding(); // Renderiza el juego en estado POST_FADE_ENDING (pantalla negra)
|
void renderPostFadeEnding(); // Renderiza el juego en estado POST_FADE_ENDING (pantalla negra)
|
||||||
auto changeRoom(const std::string& room_path) -> bool; // Cambia de habitación
|
auto changeRoom(const std::string& room_path) -> bool; // Cambia de habitación
|
||||||
void handleInput(); // Comprueba el teclado
|
void handleInput(); // Comprueba el teclado
|
||||||
void checkPlayerIsOnBorder(); // Comprueba si el jugador esta en el borde de la pantalla y actua
|
void handlePlayerIsOnBorder(); // Comprueba si el jugador esta en el borde de la pantalla y actua
|
||||||
auto checkPlayerAndEnemies() -> bool; // Comprueba las colisiones del jugador con los enemigos
|
auto handlePlayerAndEnemiesCollisions() -> bool; // Comprueba las colisiones del jugador con los enemigos
|
||||||
void checkPlayerAndItems(); // Comprueba las colisiones del jugador con los objetos
|
void handlePlayerAndItemsCollisions(); // Comprueba las colisiones del jugador con los objetos
|
||||||
void checkIfPlayerIsAlive(); // Comprueba si el jugador esta vivo
|
void handleIfPlayerIsAlive(); // Comprueba si el jugador esta vivo
|
||||||
void killPlayer(); // Mata al jugador
|
void killPlayer(); // Mata al jugador
|
||||||
void setScoreBoardColor(); // Pone el color del marcador en función del color del borde de la habitación
|
void setScoreBoardColor(); // Pone el color del marcador en función del color del borde de la habitación
|
||||||
auto checkEndGame() -> bool; // Comprueba si ha finalizado el juego
|
auto isGameCompleted() -> bool; // Comprueba si ha finalizado el juego
|
||||||
static auto getTotalItems() -> int; // Obtiene la cantidad total de items que hay en el mapeado del juego
|
static auto getTotalItems() -> int; // Obtiene la cantidad total de items que hay en el mapeado del juego
|
||||||
void togglePause(); // Pone el juego en pausa
|
void togglePause(); // Pone el juego en pausa
|
||||||
void checkRestoringJail(float delta_time); // Da vidas al jugador cuando está en la Jail
|
void restAtJail(float delta_time); // Da vidas al jugador cuando está en la Jail
|
||||||
void fillRoomNameTexture(); // Pone el nombre de la habitación en la textura
|
void fillRoomNameTexture(); // Pone el nombre de la habitación en la textura
|
||||||
void checkSomeCheevos(); // Comprueba algunos logros
|
void checkSomeCheevos(); // Comprueba algunos logros
|
||||||
void checkEndGameCheevos(); // Comprueba los logros de completar el juego
|
void checkEndGameCheevos(); // Comprueba los logros de completar el juego
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ constexpr int HALF_SIZE = SIZE / 2;
|
|||||||
|
|
||||||
namespace GameCanvas {
|
namespace GameCanvas {
|
||||||
constexpr int WIDTH = 320;
|
constexpr int WIDTH = 320;
|
||||||
constexpr int HEIGHT = 240;
|
constexpr int HEIGHT = 200;
|
||||||
constexpr int CENTER_X = WIDTH / 2;
|
constexpr int CENTER_X = WIDTH / 2;
|
||||||
constexpr int FIRST_QUARTER_X = WIDTH / 4;
|
constexpr int FIRST_QUARTER_X = WIDTH / 4;
|
||||||
constexpr int THIRD_QUARTER_X = (WIDTH / 4) * 3;
|
constexpr int THIRD_QUARTER_X = (WIDTH / 4) * 3;
|
||||||
@@ -26,22 +26,22 @@ constexpr int Y = 0;
|
|||||||
|
|
||||||
// Dimensiones en tiles
|
// Dimensiones en tiles
|
||||||
constexpr int TILE_COLS = 40; // Ancho del mapa en tiles
|
constexpr int TILE_COLS = 40; // Ancho del mapa en tiles
|
||||||
constexpr int TILE_ROWS = 24; // Alto del mapa en tiles
|
constexpr int TILE_ROWS = 20; // Alto del mapa en tiles
|
||||||
constexpr int TILE_COUNT = TILE_COLS * TILE_ROWS; // 960 tiles totales
|
constexpr int TILE_COUNT = TILE_COLS * TILE_ROWS; // 800 tiles totales
|
||||||
|
|
||||||
// Dimensiones en pixels
|
// Dimensiones en pixels
|
||||||
constexpr int WIDTH = TILE_COLS * Tile::SIZE; // 320
|
constexpr int WIDTH = TILE_COLS * Tile::SIZE; // 320
|
||||||
constexpr int HEIGHT = TILE_ROWS * Tile::SIZE; // 192
|
constexpr int HEIGHT = TILE_ROWS * Tile::SIZE; // 160
|
||||||
|
|
||||||
// Bordes (derivados, útiles para colisiones)
|
// Bordes (derivados, útiles para colisiones)
|
||||||
constexpr int LEFT = X;
|
constexpr int LEFT = X;
|
||||||
constexpr int TOP = Y;
|
constexpr int TOP = Y;
|
||||||
constexpr int RIGHT = X + WIDTH; // 320
|
constexpr int RIGHT = X + WIDTH; // 320
|
||||||
constexpr int BOTTOM = Y + HEIGHT; // 192
|
constexpr int BOTTOM = Y + HEIGHT; // 160
|
||||||
|
|
||||||
// Puntos de referencia
|
// Puntos de referencia
|
||||||
constexpr int CENTER_X = X + (WIDTH / 2); // 160
|
constexpr int CENTER_X = X + (WIDTH / 2); // 160
|
||||||
constexpr int CENTER_Y = Y + (HEIGHT / 2); // 96
|
constexpr int CENTER_Y = Y + (HEIGHT / 2); // 80
|
||||||
constexpr int QUARTER_X = WIDTH / 4;
|
constexpr int QUARTER_X = WIDTH / 4;
|
||||||
constexpr int QUARTER_Y = HEIGHT / 4;
|
constexpr int QUARTER_Y = HEIGHT / 4;
|
||||||
} // namespace PlayArea
|
} // namespace PlayArea
|
||||||
@@ -49,17 +49,17 @@ constexpr int QUARTER_Y = HEIGHT / 4;
|
|||||||
namespace ScoreboardArea {
|
namespace ScoreboardArea {
|
||||||
// Origen (justo debajo de PlayArea)
|
// Origen (justo debajo de PlayArea)
|
||||||
constexpr int X = 0;
|
constexpr int X = 0;
|
||||||
constexpr int Y = PlayArea::BOTTOM; // 192
|
constexpr int Y = PlayArea::BOTTOM; // 160
|
||||||
|
|
||||||
// Dimensiones
|
// Dimensiones
|
||||||
constexpr int WIDTH = GameCanvas::WIDTH; // 320
|
constexpr int WIDTH = GameCanvas::WIDTH; // 320
|
||||||
constexpr int HEIGHT = (6 * Tile::SIZE); // 48
|
constexpr int HEIGHT = (5 * Tile::SIZE); // 40
|
||||||
|
|
||||||
// Bordes
|
// Bordes
|
||||||
constexpr int LEFT = X;
|
constexpr int LEFT = X;
|
||||||
constexpr int TOP = Y;
|
constexpr int TOP = Y;
|
||||||
constexpr int RIGHT = X + WIDTH;
|
constexpr int RIGHT = X + WIDTH;
|
||||||
constexpr int BOTTOM = Y + HEIGHT; // 240
|
constexpr int BOTTOM = Y + HEIGHT; // 200
|
||||||
} // namespace ScoreboardArea
|
} // namespace ScoreboardArea
|
||||||
|
|
||||||
namespace Collision {
|
namespace Collision {
|
||||||
|
|||||||
Reference in New Issue
Block a user