Browse Source

Updated practice mode scores

tags/8.1
Madiwka 3 years ago
parent
commit
be596a2992
2 changed files with 6 additions and 3 deletions
  1. +1
    -0
      entities/planet/planet.lua
  2. +5
    -3
      levels/practice.lua

+ 1
- 0
entities/planet/planet.lua View File

@@ -9,6 +9,7 @@ self.y = y
self.mass = mass
self.attractionX = 0
self.attractionY = 0
self.charge = 20
self.r = radius
self.w = img:getWidth()
self.image = img


+ 5
- 3
levels/practice.lua View File

@@ -61,6 +61,10 @@ function practice.update(dt)
firstShip:update(dt)
for i in ipairs(planets) do
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
for i in ipairs(cannons) do
cannons[i]:update(dt)
@@ -74,9 +78,7 @@ function practice.update(dt)
--print("killing")
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
camera:follow(VCAM.x, VCAM.y)
end


Loading…
Cancel
Save