Game closes as soon as it starts.
Posted: Thu May 15, 2014 6:16 pm
Hello, I have a problem with the game I am currently trying to make. More specifically I have a chunk of code that appears to cause a crash at startup. More specifically this chunk which is inside of love.update.
What I want to do is choose a random coordinate for x and check if set position is on the player, if it is not then repeat the same for y and set the apple once things check out fine. I have sent the code to a friend of mine who has successfully executed it and played, I however could not. I tried running it using the 32-bit and 64-bit engines (love 0.9.1) to no avail. If it's of any relevance I'm running all of this on my Win7 x64 Virtual Machine on VirtualBox. I have attached the .love if you wish to check it out. Help will be greatly appreciated.
This is my first time posting on theses forums so my apologies if I haven't added something necessary for you to assist me, simply tell me and I will do my best to fill you in on the missing details.
Thanks in advance.
Code: Select all
--set apple
if apple.spawned == false then
--is apple.x on player?
local x = 0
while x == 0 do
apple.x = love.math.random(0, (wWidth - apple.size))
if (apple.x + apple.size) < player.x or apple.x > (player.x + player.size) then
x = 1
end
end
--is apple.y on player?
local y = 0
while y == 0 do
apple.y = love.math.random(0, (wHeight - apple.size))
if (apple.y + apple.size) < player.y or apple.y > (player.y + player.size) then
y = 1
end
end
--apple has spawned
apple.spawned = true
end
This is my first time posting on theses forums so my apologies if I haven't added something necessary for you to assist me, simply tell me and I will do my best to fill you in on the missing details.
Thanks in advance.