It's basically a remake of my old Asteroid Dodgers (or Meteor Shower or whatever I called it) from the old site, totally redone from scratch.
I need to work on adding the final touches and some balancing to make it actually survivable, but it should be working just fine.
However, when I load it in the editor and hit play, after it completes the first round, I get a NegativeArrayException.
Any ideas why? I'm going to try to debug it some more later, but if anyone else can help that'd be great.
http://2dworlds.org/game.php?id=31
Here's the script I believe to be the problem:
The game freezes, and then the music begins to play again. So I suspect the problem is somewhere here:
game.World.BGM:play()
game.World.Meteors.Create.Value = true
ticky(140, 140)
EDIT: It is also now crashing with this error at other times as well.
I need to work on adding the final touches and some balancing to make it actually survivable, but it should be working just fine.
However, when I load it in the editor and hit play, after it completes the first round, I get a NegativeArrayException.
Code:
java.lang.NegativeArraySizeException
org.jbox2d.dynamics.Island.init(Island.java:118)
org.jbox2d.dynamics.PhysicsWorld.solve(PhysicsWorld.java:669)
org.jbox2d.dynamics.PhysicsWorld.step(PhysicsWorld.java:572)
net.worlds.World.step(World.java:736)
net.worlds.Game.step(Game.java:295)
net.worlds.Main.gameStep(Main.java:657)
net.worlds.MainApplet.run(MainApplet.java:236)
java.lang.Thread.run(Unknown Source)
Any ideas why? I'm going to try to debug it some more later, but if anyone else can help that'd be great.
http://2dworlds.org/game.php?id=31
Here's the script I believe to be the problem:
Code:
function checkWhoSurvived()
local players = game.Players:getChildren()
for q = 1, #players do
players[q].Stats.Played.Value = players[q].Stats.Played.Value + 1
if players[q].Alive.Value == true then
players[q].Stats.Survived.Value = players[q].Stats.Survived.Value + 1
else
players[q].Alive.Value = true
end
end
end
function redoWorld()
local spawn = game.World:getChild("Spawn")
local players = game.Players:getChildren()
for w = 1, #players do
if players[w].Character ~= nil then
players[w].Character.Body.Position = spawn.Position
end
end
game.Terrain:generate()
end
function ticky(top, num)
for z = 1, num do
local players = game.Players:getChildren()
for x = 1, #players do
players[x]:message(tostring(top - z))
end
sleep(1)
end
local players = game.Players:getChildren()
for c = 1, #players do
players[c]:message()
end
end
function cleanup()
local parts = game.World:getChildren()
for y = 1, #parts do
if parts[y]:isA("Circle") and string.sub(parts[y].Name, 1, 6) == "Meteor" then
parts[y]:remove()
end
end
end
while true do
game.World.BGM:stop()
game.World.Meteors.Create.Value = false
cleanup()
redoWorld()
local players = game.Players:getChildren()
for e = 1, #players do
players[e]:message("Beginning new round!")
players[e].Alive.Value = true
end
sleep(4)
for r = 1, #players do
players[r]:message()
end
game.World.BGM:play()
game.World.Meteors.Create.Value = true
ticky(140, 140)
checkWhoSurvived()
end
The game freezes, and then the music begins to play again. So I suspect the problem is somewhere here:
game.World.BGM:play()
game.World.Meteors.Create.Value = true
ticky(140, 140)
EDIT: It is also now crashing with this error at other times as well.