Skip to content

Instantly share code, notes, and snippets.

@dermotbalson
Created April 26, 2013 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dermotbalson/5465368 to your computer and use it in GitHub Desktop.
Save dermotbalson/5465368 to your computer and use it in GitHub Desktop.
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