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.
71 changes: 67 additions & 4 deletions plataformas/GameLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ 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

loadMap("res/" + to_string(game->currentLevel) + ".txt");
Expand Down Expand Up @@ -73,6 +79,14 @@ 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); // Realmente no hace falta
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 +259,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 +287,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,6 +334,16 @@ 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);
}
}

for (auto const& enemy : enemies) {
Expand All @@ -308,6 +358,12 @@ void GameLayer::update() {
}
}

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

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

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

for (auto const& projectile : projectiles) {
projectile->draw(scrollX);
}
Expand All @@ -364,6 +424,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
7 changes: 7 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 Down Expand Up @@ -41,11 +42,17 @@ class GameLayer : public Layer
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
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>
8 changes: 4 additions & 4 deletions plataformas/res/0.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.............................................
.............................................
.............................................
.............................................
..####.......................................
....R........................................
..####.....R........................R........
..........####.....................###.#.....
.............................................
#.1.............C..........................##
#######..####################################
#.1........R.....R....R......C.............##
#############################################
.............................................