Corregido bug en el movimiento de los enemigos
This commit is contained in:
4
Makefile
4
Makefile
@@ -28,6 +28,10 @@ windows_release:
|
||||
powershell Copy-Item "README.md" -Destination "$(releaseFolder)"
|
||||
powershell Copy-Item "release/SDL2.dll" -Destination "$(releaseFolder)"
|
||||
|
||||
# Remove data
|
||||
powershell if (Test-Path "$(releaseFolder)\data\room\map.world") {Remove-Item "$(releaseFolder)\data\room\map.world" -Recurse -Force}
|
||||
powershell if (Test-Path "$(releaseFolder)\data\room\standard.tsx") {Remove-Item "$(releaseFolder)\data\room\standard.tsx" -Recurse -Force}
|
||||
|
||||
# Build
|
||||
g++ $(source) -D RELEASE -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(releaseFolder)/$(executable).exe"
|
||||
strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable).exe" --strip-unneeded
|
||||
|
||||
@@ -8,58 +8,3 @@ roomDown=04.room
|
||||
roomLeft=01.room
|
||||
roomRight=03.room
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
width=16
|
||||
height=16
|
||||
x=5
|
||||
y=6
|
||||
vx=0
|
||||
vy=0.4
|
||||
x1=5
|
||||
y1=4
|
||||
x2=5
|
||||
y2=10
|
||||
color=bright_red
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
width=16
|
||||
height=16
|
||||
x=13
|
||||
y=1
|
||||
vx=0
|
||||
vy=0.4
|
||||
x1=13
|
||||
y1=1
|
||||
x2=13
|
||||
y2=9
|
||||
color=red
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=chip.png
|
||||
animation=chip.ani
|
||||
width=8
|
||||
height=16
|
||||
x=8
|
||||
y=13
|
||||
vx=0.4
|
||||
vy=0
|
||||
x1=8
|
||||
y1=13
|
||||
x2=23
|
||||
y2=13
|
||||
color=yellow
|
||||
[/enemy]
|
||||
|
||||
[item]
|
||||
tileSetFile=items.png
|
||||
tile=21
|
||||
x=1
|
||||
y=9
|
||||
counter=1
|
||||
[/item]
|
||||
@@ -15,13 +15,13 @@ tileSetFile=chip.png
|
||||
animation=chip.ani
|
||||
width=8
|
||||
height=16
|
||||
x=1
|
||||
x=7
|
||||
y=3
|
||||
vx=1
|
||||
vy=0
|
||||
x1=1
|
||||
x1=2
|
||||
y1=3
|
||||
x2=14
|
||||
x2=13
|
||||
y2=3
|
||||
color=magenta
|
||||
[/enemy]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name=I REMEMBER THIS ONE TOO
|
||||
name=I DID NOT COPY THIS ONE
|
||||
bgColor=black
|
||||
border=magenta
|
||||
tileMapFile=17.tmx
|
||||
@@ -13,21 +13,53 @@ tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
width=16
|
||||
height=16
|
||||
x=2
|
||||
y=2
|
||||
x=5
|
||||
y=6
|
||||
vx=0
|
||||
vy=0.4
|
||||
x1=5
|
||||
y1=4
|
||||
x2=5
|
||||
y2=10
|
||||
color=bright_red
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=diskette.png
|
||||
animation=diskette.ani
|
||||
width=16
|
||||
height=16
|
||||
x=13
|
||||
y=1
|
||||
vx=0
|
||||
vy=0.4
|
||||
x1=13
|
||||
y1=1
|
||||
x2=13
|
||||
y2=9
|
||||
color=red
|
||||
[/enemy]
|
||||
|
||||
[enemy]
|
||||
tileSetFile=chip.png
|
||||
animation=chip.ani
|
||||
width=8
|
||||
height=16
|
||||
x=8
|
||||
y=13
|
||||
vx=0.4
|
||||
vy=0
|
||||
x1=2
|
||||
y1=2
|
||||
x2=2
|
||||
y2=2
|
||||
color=magenta
|
||||
x1=8
|
||||
y1=13
|
||||
x2=23
|
||||
y2=13
|
||||
color=yellow
|
||||
[/enemy]
|
||||
|
||||
[item]
|
||||
tileSetFile=items.png
|
||||
tile=1
|
||||
x=1
|
||||
y=1
|
||||
tile=21
|
||||
x=2
|
||||
y=9
|
||||
counter=1
|
||||
[/item]
|
||||
@@ -64,7 +64,20 @@ void Enemy::checkPath()
|
||||
{
|
||||
if (sprite->getPosX() > x2 || sprite->getPosX() < x1)
|
||||
{
|
||||
// Recoloca
|
||||
if (sprite->getPosX() > x2)
|
||||
{
|
||||
sprite->setPosX(x2);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->setPosX(x1);
|
||||
}
|
||||
|
||||
// Cambia el sentido
|
||||
sprite->setVelX(sprite->getVelX() * (-1));
|
||||
|
||||
// Invierte el sprite
|
||||
if (doFlip)
|
||||
{
|
||||
sprite->flipH();
|
||||
@@ -73,7 +86,20 @@ void Enemy::checkPath()
|
||||
|
||||
if (sprite->getPosY() > y2 || sprite->getPosY() < y1)
|
||||
{
|
||||
// Recoloca
|
||||
if (sprite->getPosY() > y2)
|
||||
{
|
||||
sprite->setPosY(y2);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite->setPosY(y1);
|
||||
}
|
||||
|
||||
// Cambia el sentido
|
||||
sprite->setVelY(sprite->getVelY() * (-1));
|
||||
|
||||
// Invierte el sprite
|
||||
if (doFlip)
|
||||
{
|
||||
sprite->flipH();
|
||||
|
||||
Reference in New Issue
Block a user