Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plataformas/Debug/plataformas.exe.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\uo276406\Desktop\plataformas\Debug\plataformas.exe</FullPath>
<FullPath>C:\Users\diego\OneDrive\Escritorio\SEV\plataformas\Debug\plataformas.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
Expand Down
Binary file modified plataformas/Debug/plataformas.ilk
Binary file not shown.
127 changes: 28 additions & 99 deletions plataformas/Debug/plataformas.log

Large diffs are not rendered by default.

Binary file modified plataformas/Debug/plataformas.tlog/CL.command.1.tlog
Binary file not shown.
Binary file modified plataformas/Debug/plataformas.tlog/CL.read.1.tlog
Binary file not shown.
Binary file modified plataformas/Debug/plataformas.tlog/CL.write.1.tlog
Binary file not shown.
Binary file modified plataformas/Debug/plataformas.tlog/link.command.1.tlog
Binary file not shown.
Binary file modified plataformas/Debug/plataformas.tlog/link.read.1.tlog
Binary file not shown.
Binary file modified plataformas/Debug/plataformas.tlog/link.write.1.tlog
Binary file not shown.
4 changes: 2 additions & 2 deletions plataformas/Debug/plataformas.tlog/plataformas.lastbuildstate
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30037:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|C:\Users\uo276406\Desktop\plataformas\|
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.18362.0:
Debug|Win32|C:\Users\diego\OneDrive\Escritorio\SEV\plataformas\|
Binary file modified plataformas/Debug/vc142.idb
Binary file not shown.
Binary file modified plataformas/Debug/vc142.pdb
Binary file not shown.
2 changes: 2 additions & 0 deletions plataformas/Enemy.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "Actor.h"
#include "Enemy.h"


Enemy::Enemy(float x, float y, Game* game)
: Actor("res/enemigo.png", x, y, 36, 40, game) {

Expand Down
1 change: 1 addition & 0 deletions plataformas/Enemy.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Enemy : public Actor
{
public:
Enemy(float x, float y, Game* game);

void draw(float scrollX = 0) override; // Va a sobrescribir
void update();
void impacted(); // Recibe impacto y pone animaci�n de morir
Expand Down
115 changes: 111 additions & 4 deletions plataformas/GameLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ void GameLayer::init() {
textPoints = new Text("hola", WIDTH * 0.92, HEIGHT * 0.04, game);
textPoints->content = to_string(points);


pointsRecolectable = 0;
textPointsRecolectable = new Text("hola", WIDTH * 0.92, HEIGHT * 0.14, game);
textPointsRecolectable->content = to_string(pointsRecolectable);

background = new Background("res/fondo_2.png", WIDTH * 0.5, HEIGHT * 0.5, -1, game);
backgroundPoints = new Actor("res/icono_puntos.png",
WIDTH * 0.85, HEIGHT * 0.05, 24, 24, game);

recolectable = new Item(WIDTH * 0.85, HEIGHT * 0.15, game);

enemies.clear(); // Vaciar por si reiniciamos el juego
recolectables.clear();
projectiles.clear(); // Vaciar por si reiniciamos el juego
destructibles.clear();

loadMap("res/" + to_string(game->currentLevel) + ".txt");
}
Expand Down Expand Up @@ -73,6 +80,22 @@ void GameLayer::loadMapObject(char character, float x, float y)
space->addDynamicActor(cup); // Realmente no hace falta
break;
}
case 'R': {
Tile* recolectable = new Tile("res/icono_recolectable.png", x, y, game);
// modificaci�n para empezar a contar desde el suelo.
recolectable->y = recolectable->y - recolectable->height / 2;
recolectables.push_back(recolectable);
space->addDynamicActor(recolectable);
break;
}
case 'W': {
Tile* destructible = new Tile("res/bloque_metal.png", x, y, game);
// modificaci�n para empezar a contar desde el suelo.
destructible->y = destructible->y - destructible->height / 2;
destructibles.push_back(destructible);
space->addStaticActor(destructible);
break;
}
case 'E': {
Enemy* enemy = new Enemy(x, y, game);
// modificaci�n para empezar a contar desde el suelo.
Expand Down Expand Up @@ -245,18 +268,18 @@ void GameLayer::update() {
}


// Colisiones
for (auto const& enemy : enemies) {

if (player->isOverlap(enemy)) {
player->loseLife();
player->loseLife();

if (player->lifes <= 0) {
init();
return;
}
}
}

// Colisiones , Enemy - Projectile

list<Enemy*> deleteEnemies;
list<Projectile*> deleteProjectiles;
Expand All @@ -273,7 +296,33 @@ void GameLayer::update() {
}
}

//Colisiones, Player - Recolectable
list<Tile*> deleteRecolectables;
for (auto const& recolectable : recolectables) {
if (player->isOverlap(recolectable)) {
bool rInList = std::find(deleteRecolectables.begin(),
deleteRecolectables.end(),
recolectable) != deleteRecolectables.end();

if (!rInList) {
deleteRecolectables.push_back(recolectable);
}


pointsRecolectable++;
if (pointsRecolectable % 4 == 0) {
textPointsRecolectable->content = to_string(pointsRecolectable/4);
this->recolectable->idle->currentFrame = 2;
}

this->recolectable->update();

}

}

// Colisiones , Enemy - Projectile
// Player(saltando) - enemy

for (auto const& enemy : enemies) {
for (auto const& projectile : projectiles) {
Expand All @@ -294,8 +343,43 @@ void GameLayer::update() {

}
}
if (player->vy > 0 && player->y < enemy->y
&& player->isOverlap(enemy)
&& player->lifes > 0) {

enemy->impacted();
player->lifes++;
player->invulnerableTime = 0;
points++;
textPoints->content = to_string(points);
}
}

//Tiles destructibles
list<Tile*> deleteDestructibles;
for (auto const& destructible : destructibles) {

if ((player->y - destructible->y) < 10 &&
abs(player->x - destructible->x) < 10 &&
destructionTime % 10 == 0) {

space->addDynamicActor(destructible);
space->removeStaticActor(destructible);

bool dInList = std::find(deleteDestructibles.begin(),
deleteDestructibles.end(),
destructible) != deleteDestructibles.end();

if (!dInList) {
deleteDestructibles.push_back(destructible);
}

destructionTime = 10;
}
}

destructionTime--;

for (auto const& enemy : enemies) {
if (enemy->state == game->stateDead) {
bool eInList = std::find(deleteEnemies.begin(),
Expand All @@ -308,6 +392,18 @@ void GameLayer::update() {
}
}

for (auto const& delRecolectable : deleteRecolectables) {
recolectables.remove(delRecolectable);
space->removeDynamicActor(delRecolectable);
}
deleteRecolectables.clear();

for (auto const& delDestructible : deleteDestructibles) {
destructibles.remove(delDestructible);
space->removeDynamicActor(delDestructible);
}
deleteDestructibles.clear();

for (auto const& delEnemy : deleteEnemies) {
enemies.remove(delEnemy);
space->removeDynamicActor(delEnemy);
Expand Down Expand Up @@ -350,6 +446,14 @@ void GameLayer::draw() {
tile->draw(scrollX);
}

for (auto const& recolectable : recolectables) {
recolectable->draw(scrollX);
}

for (auto const& destructible : destructibles) {
destructible->draw(scrollX);
}

for (auto const& projectile : projectiles) {
projectile->draw(scrollX);
}
Expand All @@ -364,6 +468,9 @@ void GameLayer::draw() {
backgroundPoints->draw();
textPoints->draw();

textPointsRecolectable->draw();
recolectable->draw();

// HUD
if (game->input == game->inputMouse) {
buttonJump->draw(); // NO TIENEN SCROLL, POSICION FIJA
Expand Down
10 changes: 10 additions & 0 deletions plataformas/GameLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "Audio.h"
#include "Space.h" // importar
#include "Item.h"

#include "Pad.h"

Expand All @@ -37,15 +38,24 @@ class GameLayer : public Layer
float scrollX;
int mapWidth;
list<Tile*> tiles;

list<Tile*> destructibles;
int destructionTime = 9;

Audio* audioBackground;
Text* textPoints;
int points;

Text* textPointsRecolectable;
int pointsRecolectable;
Item* recolectable;

int newEnemyTime = 0;
Player* player;
Background* background;
Actor* backgroundPoints;
list<Enemy*> enemies;
list<Tile*> recolectables;
list<Projectile*> projectiles;
Tile* cup; // Elemento de final de nivel

Expand Down
1 change: 1 addition & 0 deletions plataformas/GenericEnemy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "GenericEnemy.h"
13 changes: 13 additions & 0 deletions plataformas/GenericEnemy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once
#include "Actor.h"
class GenericEnemy :
public Actor
{

void virtual draw() = 0; // Va a sobrescribir
void virtual update() = 0;

GenericEnemy(string filename, float x, float y, int width, int height, Game* game);

};

20 changes: 20 additions & 0 deletions plataformas/Item.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "Item.h"

Item::Item(float x, float y, Game* game) {
this->x = x;
this->y = y;
idle = new Animation("res/recolectable.png",
32, 32 ,256, 32, 0, 8, true, game);
idle->currentFrame = 2;
update();

}

void Item::update() {

idle->update();
}

void Item::draw() {
idle->draw(x, y);
}
18 changes: 18 additions & 0 deletions plataformas/Item.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include "Actor.h"
#include "Animation.h"

class Item
{
public:
Item(float x, float y, Game* game);
Animation* idle;

float x;
float y;

void update();
void draw();
};

2 changes: 2 additions & 0 deletions plataformas/plataformas.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
<ClCompile Include="Enemy.cpp" />
<ClCompile Include="Game.cpp" />
<ClCompile Include="GameLayer.cpp" />
<ClCompile Include="Item.cpp" />
<ClCompile Include="Layer.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="MenuLayer.cpp" />
Expand All @@ -171,6 +172,7 @@
<ClInclude Include="Enemy.h" />
<ClInclude Include="Game.h" />
<ClInclude Include="GameLayer.h" />
<ClInclude Include="Item.h" />
<ClInclude Include="Layer.h" />
<ClInclude Include="MenuLayer.h" />
<ClInclude Include="Pad.h" />
Expand Down
6 changes: 6 additions & 0 deletions plataformas/plataformas.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
<ClCompile Include="MenuLayer.cpp">
<Filter>Archivos de origen\Layer</Filter>
</ClCompile>
<ClCompile Include="Item.cpp">
<Filter>Archivos de origen</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game.h">
Expand Down Expand Up @@ -116,5 +119,8 @@
<ClInclude Include="MenuLayer.h">
<Filter>Archivos de encabezado\Layer</Filter>
</ClInclude>
<ClInclude Include="Item.h">
<Filter>Archivos de encabezado</Filter>
</ClInclude>
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions plataformas/res/0.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.............................................
.............................................
.............................................
....R........................................
..####.....R........................R........
..........####.....WWWWWW.W..W.....###.#.....
.............................................
..####.......................................
..........####.....................###.#.....
.............................................
#.1.............C..........................##
#######..####################################
#.1........R.....R....R......C.............##
#############################################
.............................................