Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
bullets1
function setup()
physics.gravity(0,0)
bullets={}
end
function touched(touch)
x = touch.x
y = touch.y
if touch.state == BEGAN then --create bullet
local bullet = physics.body(CIRCLE,10) -- <<NEW
bullet.x,bullet.y = x,y
bullet.linearVelocity = vec2(1000,0)
bullet.restitution = 0
bullet.type = DYNAMIC
table.insert(bullets,bullet)
end
end
function draw()
background(0, 0, 0, 255)
--draw bullets
pushStyle()
fill(255, 255, 255, 255)
--ellipse(bullet.x,bullet.y,10)
for i,b in pairs(bullets) do
ellipse(b.x,b.y,10)
end
popStyle()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.