@@ -29,8 +29,6 @@ local menu,ct,play
|
|||||||
local score
|
local score
|
||||||
local sunH,color,rot
|
local sunH,color,rot
|
||||||
|
|
||||||
local drawn=false
|
|
||||||
|
|
||||||
local function near(o,t)
|
local function near(o,t)
|
||||||
return o>t and max(o-.01,t)or o<t and min(o+.01,t)or o
|
return o>t and max(o-.01,t)or o<t and min(o+.01,t)or o
|
||||||
end
|
end
|
||||||
@@ -127,9 +125,6 @@ function scene.keyUp(key)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scene.update(dt)
|
function scene.update(dt)
|
||||||
if not drawn then return end
|
|
||||||
drawn=false
|
|
||||||
|
|
||||||
dt=dt*600
|
dt=dt*600
|
||||||
|
|
||||||
--Update cubes' position
|
--Update cubes' position
|
||||||
@@ -148,6 +143,24 @@ function scene.update(dt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Collision detect
|
||||||
|
if play then
|
||||||
|
for j=1,40 do
|
||||||
|
local i=(j+lastCube-2)%40+1
|
||||||
|
local Y=cubesY[i]
|
||||||
|
if Y<8.8 then
|
||||||
|
local size=100/(10-Y)
|
||||||
|
local x=(cubesX[i]-player)/(10-Y)*200-size*.5
|
||||||
|
local y=5/(10-Y)*150-50
|
||||||
|
if y>420 and y<480 and x<8 and x+size>-8 and inv==0 then
|
||||||
|
cubesX[i]=cubesX[i]-3
|
||||||
|
hurt(650)
|
||||||
|
inv=40
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--Screen rotation
|
--Screen rotation
|
||||||
if moveDir~=0 then
|
if moveDir~=0 then
|
||||||
player=player+moveDir*dt*.003*speed^.8
|
player=player+moveDir*dt*.003*speed^.8
|
||||||
@@ -193,7 +206,6 @@ function scene.update(dt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function scene.draw()
|
function scene.draw()
|
||||||
drawn=true
|
|
||||||
--Health bar
|
--Health bar
|
||||||
if life1>0 then
|
if life1>0 then
|
||||||
gc.setColor(1,0,0)
|
gc.setColor(1,0,0)
|
||||||
@@ -245,12 +257,6 @@ function scene.draw()
|
|||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
gc.rectangle('line',x,y-485,size,size)
|
gc.rectangle('line',x,y-485,size,size)
|
||||||
end
|
end
|
||||||
|
|
||||||
if play and y>420 and y<480 and x<8 and x+size>-8 and inv==0 then
|
|
||||||
cubesX[i]=cubesX[i]-3
|
|
||||||
hurt(650)
|
|
||||||
inv=40
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user