Compare commits
No commits in common. "974d5d87ac6e31925bd0e4683922b5cfde4a0e1c" and "1a041ce6bbc349d07de8a1a4a0921adf34ce4f42" have entirely different histories.
974d5d87ac
...
1a041ce6bb
20
main.lua
20
main.lua
@ -7,10 +7,10 @@ require("maploader")
|
|||||||
points=0
|
points=0
|
||||||
mp={
|
mp={
|
||||||
{0,0,0,0,0,0,0,0,0},
|
{0,0,0,0,0,0,0,0,0},
|
||||||
{0,0,0,0,0,0,"e",0,0},
|
{0,0,0,0,0,0,0,"e",0},
|
||||||
{0,0,0,0,1,1,1,1,1},
|
{0,0,0,0,1,1,1,1,1},
|
||||||
{0,0,0,0,0,0,0,0,0},
|
{0,0,0,0,0,0,0,0,0},
|
||||||
{2,2,2,2,0,0,0,0,0},
|
{1,1,1,1,0,0,0,0,0},
|
||||||
{0,0,0,0,0,0,0,0,0},
|
{0,0,0,0,0,0,0,0,0},
|
||||||
{0,0,0,0,0,0,0,0,0}
|
{0,0,0,0,0,0,0,0,0}
|
||||||
}
|
}
|
||||||
@ -205,19 +205,14 @@ function love.update(dt)
|
|||||||
en.x=en.x+2*en.dir
|
en.x=en.x+2*en.dir
|
||||||
for _,ti in pairs(t.tiles) do
|
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 en.y+en.h>=ti.y and en.y+en.h<=ti.y+ti.h then
|
||||||
if ti.x>=en.x then
|
if ti.x==en.x and ti.y==en.y+en.h then
|
||||||
en.dir=1
|
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
|
en.dir=-1
|
||||||
end
|
end
|
||||||
en.onground=true
|
en.onground=true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not en.onground then
|
|
||||||
en.dy=en.dy+1
|
|
||||||
en.y=en.y+en.dy
|
|
||||||
end
|
|
||||||
en.onground=false
|
|
||||||
end
|
end
|
||||||
if player.cooldown~=0 then
|
if player.cooldown~=0 then
|
||||||
player.cooldown=player.cooldown-1
|
player.cooldown=player.cooldown-1
|
||||||
@ -225,6 +220,13 @@ function love.update(dt)
|
|||||||
if #e.enemies==0 and not lose and not win then
|
if #e.enemies==0 and not lose and not win then
|
||||||
win=true
|
win=true
|
||||||
end
|
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
|
player.onground=false
|
||||||
if player.x==0 then
|
if player.x==0 then
|
||||||
moveleft=false
|
moveleft=false
|
||||||
|
|||||||
@ -25,7 +25,8 @@ function loadmap(map)
|
|||||||
if x~=0 and type(x)=="number" then
|
if x~=0 and type(x)=="number" then
|
||||||
t:new(x, (c*32)-32, (q*32)-32)
|
t:new(x, (c*32)-32, (q*32)-32)
|
||||||
elseif x=="e" then
|
elseif x=="e" then
|
||||||
e:new((c*32)-32,(q*32)-32,32,32,3)
|
e:new(0,0,(c*32)-32,(q*32)-32,3)
|
||||||
|
print(tostring(q..c))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user