Hey,
How might I go about making bullets?
I've made a bullet class, but I can't figure out how I go about using them, as in, editing them once they're made.
I have:
Obviously I can do aCode:Bullet = {} Bullet.new = function(x, y) local self = {} local x = x or love.mouse.getX() local y = y or love.mouse.getY() self.getX = function() return x end self.getY = function() return y end self.setX = function(val) x = val end self.setY = function(val) Y = val end return self end
But how can I make more than 1 and be able to modify its position?Code:if fire then bullet = Bullet.new(x, y) end
I tried something like
but that didn't seem to work :/Code:bullets = {} for i = 0, 20 do bullets[i] = Bullet.new() end for i = 0, 20 do bullets[i].setX(500) end
Any help?
Thanks

Register
Events
Popular
More
Post #1



Funny x 5
Agree x 1
Friendly x 1