Sfoglia il codice sorgente

Updated practice mode scores

tags/8.1
Madiwka 3 anni fa
parent
commit
be596a2992
2 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. +1
    -0
      entities/planet/planet.lua
  2. +5
    -3
      levels/practice.lua

+ 1
- 0
entities/planet/planet.lua Vedi 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 Vedi 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


Caricamento…
Annulla
Salva