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
4 changes: 2 additions & 2 deletions plataformas/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Actor::Actor(string filename, float x, float y, int width, int height, Game* gam
this->height = height;
}

void Actor::draw(float scrollX) {
void Actor::draw(float scrollX, float scrollY) {
// Recorte en el fichero de la imagen
SDL_Rect source;
source.x = 0;
Expand All @@ -31,7 +31,7 @@ void Actor::draw(float scrollX) {
// Donde se va a pegar en el renderizador
SDL_Rect destination;
destination.x = x - width / 2 - scrollX;
destination.y = y - height / 2;
destination.y = y - height / 2 - scrollY;
destination.w = width;
destination.h = height;
// Modificar para que la referencia sea el punto central
Expand Down
2 changes: 1 addition & 1 deletion plataformas/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Actor
public:
Actor(string filename, float x, float y, int width, int height, Game* game);
~Actor();
virtual void draw(float scrollX = 0);
virtual void draw(float scrollX = 0, float scrollY = 0);
bool isOverlap(Actor* actor);
bool isInRender(float scrollX = 0);
bool containsPoint(int pointX, int pointY); // contiene punto
Expand Down
12 changes: 11 additions & 1 deletion plataformas/Background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void Background::update() {
}
}

void Background::draw(float scrollX) {
void Background::draw(float scrollX, float scrollY) {
Actor::draw(); // llamar al metodo del hijo

if (backgroundAux != NULL) {
Expand All @@ -46,6 +46,16 @@ void Background::draw(float scrollX) {
// pintar aux por la derecha
backgroundAux->x = x + width;
}
// zona sin cubrir por abajo
if (y - height / 2 > 0) {
// pintar aux por abajo
backgroundAux->y = y - height;
}
// zona sin cubrir por arriba
if (y + height / 2 < HEIGHT) {
// pintar aux por arriba
backgroundAux->y = y + height;
}
backgroundAux->draw();
}

Expand Down
2 changes: 1 addition & 1 deletion plataformas/Background.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Background : public Actor
public:
Background(string filename, float x, float y, Game* game);
Background(string filename, float x, float y, float vx, Game* game);
void draw(float scrollX = 0) override; // Va a sobrescribir
void draw(float scrollX = 0, float scrollY = 0) override; // Va a sobrescribir
void update();
Background* backgroundAux = nullptr;

Expand Down
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.
19 changes: 9 additions & 10 deletions plataformas/Enemy.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#include "Actor.h"
#include "Enemy.h"

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

state = game->stateMoving;
Enemy::Enemy(string filename, float x, float y, Game* game)
: Actor(filename, x, y, 36, 40, game) {

aDying = new Animation("res/enemigo_morir.png", width, height,
280, 40, 6, 8, false, game);
state = game->stateMoving;

aMoving = new Animation("res/enemigo_movimiento.png", width, height,
108, 40, 6, 3, true, game);
animation = aMoving;

vx = 1;
vxIntelligence = -1;
Expand Down Expand Up @@ -61,8 +57,11 @@ void Enemy::impacted() {
}


void Enemy::draw(float scrollX) {
animation->draw(x - scrollX, y);
void Enemy::draw(float scrollX, float scrollY) {
}

Projectile* Enemy::shoot() {
return NULL;
}


12 changes: 9 additions & 3 deletions plataformas/Enemy.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

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

class Enemy : public Actor
{
public:
Enemy(float x, float y, Game* game);
void draw(float scrollX = 0) override; // Va a sobrescribir
void update();
Enemy(string filename, float x, float y, Game* game);

virtual void draw(float scrollX = 0, float scrollY = 0) override; // Va a sobrescribir
virtual void update();
virtual Projectile* shoot();
void impacted(); // Recibe impacto y pone animaci�n de morir
float vxIntelligence;
int state;
Animation* aDying;
Animation* aMoving;
Animation* animation; // Referencia a la animaci�n mostrada

int enemyShootCadence = 30;

};
Loading