Poprawieni bug z przeciwnikami
This commit is contained in:
parent
8bbc0b5e67
commit
974d5d87ac
18
main.lua
18
main.lua
@ -7,7 +7,7 @@ require("maploader")
|
||||
points=0
|
||||
mp={
|
||||
{0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,"e",0},
|
||||
{0,0,0,0,0,0,"e",0,0},
|
||||
{0,0,0,0,1,1,1,1,1},
|
||||
{0,0,0,0,0,0,0,0,0},
|
||||
{2,2,2,2,0,0,0,0,0},
|
||||
@ -205,14 +205,19 @@ function love.update(dt)
|
||||
en.x=en.x+2*en.dir
|
||||
for _,ti in pairs(t.tiles) do
|
||||
if en.y+en.h>=ti.y and en.y+en.h<=ti.y+ti.h then
|
||||
if ti.x==en.x and ti.y==en.y+en.h then
|
||||
if ti.x>=en.x then
|
||||
en.dir=1
|
||||
elseif ti.x+ti.w==en.x+en.w then
|
||||
elseif ti.x+ti.w<=en.x+en.w then
|
||||
en.dir=-1
|
||||
end
|
||||
en.onground=true
|
||||
end
|
||||
end
|
||||
if not en.onground then
|
||||
en.dy=en.dy+1
|
||||
en.y=en.y+en.dy
|
||||
end
|
||||
en.onground=false
|
||||
end
|
||||
if player.cooldown~=0 then
|
||||
player.cooldown=player.cooldown-1
|
||||
@ -220,13 +225,6 @@ function love.update(dt)
|
||||
if #e.enemies==0 and not lose and not win then
|
||||
win=true
|
||||
end
|
||||
for _,ene in pairs(e.enemies) do
|
||||
if not ene.onground then
|
||||
ene.dy=ene.dy+1
|
||||
ene.y=ene.y+ene.dy
|
||||
end
|
||||
ene.onground=false
|
||||
end
|
||||
player.onground=false
|
||||
if player.x==0 then
|
||||
moveleft=false
|
||||
|
||||
@ -26,7 +26,6 @@ function loadmap(map)
|
||||
t:new(x, (c*32)-32, (q*32)-32)
|
||||
elseif x=="e" then
|
||||
e:new((c*32)-32,(q*32)-32,32,32,3)
|
||||
print(tostring(q..c))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user