Know what ? Searching on the
wiki sometimes helps fixing most of your problems by your own.
Jakemason wrote:One other thing, I compressed my folder into a zip on Mac and then changed the extension to .love and it told me there was no code.
See
Game_distribution.
Don't try to zip the project folder, but its contents. So that when you open the zip file, you should directly see main.lua, conf.lua, etc.
Jakemason wrote:Oh and, how do I make multiple instances of said ball?
That's a game logic issue.
You just have to create multiple balls. Populate your objects table.
Then loop through the table to display them.
Code: Select all
function love.load()
objects = {}
objects.balls = {}
for i = 1,10 do
objects.balls[i] = {x = ..., y = ..., shouldDraw = true}
end
objects.ballImage = love.graphics.newImage(...)
end
...
function love.draw()
...
for i,ball in ipairs(objects.balls) do
if ball.shouldDraw then love.graphics.draw(objects.ballImage, ball.x, ball.y) end
end
...
end
...
But have to fully understand how tables and control structures works in Lua.
You will find nice materials reading
PiL: at least
tables,
Numeric for,
Arrays,
Multidimensional arrays chapters.
Jakemason wrote:
All it does at the moment is appear and follow the mouse, I want it to appear and stay at the x and y position and allow me to create more balls.
That is because you used
love.keyboard.isDown, meaning "as long as a certain key is down".
Maybe what you need is using callbacks.
See
love.keypressed and
love.keyreleased, and try to mix them with the base code provided before. Shouldn't be that hard to have it working.