|
@@ -61,6 +61,10 @@ function practice.update(dt) |
|
|
firstShip:update(dt) |
|
|
firstShip:update(dt) |
|
|
for i in ipairs(planets) do |
|
|
for i in ipairs(planets) do |
|
|
planets[i]:update(dt) |
|
|
planets[i]:update(dt) |
|
|
|
|
|
if math.sqrt((firstShip.x - planets[i].x)^2 + (firstShip.y - planets[i].y)^2) > planets[i].w/3 then |
|
|
|
|
|
currentScore = currentScore + math.sqrt(planets[i].attractionX^2 + planets[i].attractionY^2)*100 |
|
|
|
|
|
print(math.sqrt(planets[i].attractionX^2 + planets[i].attractionY^2)) |
|
|
|
|
|
end |
|
|
end |
|
|
end |
|
|
for i in ipairs(cannons) do |
|
|
for i in ipairs(cannons) do |
|
|
cannons[i]:update(dt) |
|
|
cannons[i]:update(dt) |
|
@@ -74,9 +78,7 @@ function practice.update(dt) |
|
|
--print("killing") |
|
|
--print("killing") |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
if math.sqrt(firstShip.dx^2 + firstShip.dy^2) < 40 then |
|
|
|
|
|
currentScore = currentScore + math.sqrt(firstShip.dx^2 + firstShip.dy^2) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
else |
|
|
camera:follow(VCAM.x, VCAM.y) |
|
|
camera:follow(VCAM.x, VCAM.y) |
|
|
end |
|
|
end |
|
|