Thanks for the help! im making another game like the other one but this one is a 1v1 battle and I cant get the top guy in the game to shoot right.
--# Main
displayMode(FULLSCREEN)
supportedOrientations(PORTRAIT_ANY)
function setup()
msl={}
msl2={}
x=400
y=100
xx=400
yy=900
end
function draw()
background(62, 152, 50, 255)
fill(0, 0, 0, 255)
ellipse(x,y,20)
fill(255, 255, 255, 255)
ellipse(xx,yy,20)
for a,b in pairs(msl) do
ellipse(b.x,b.y,5,5) --green
b.y=b.y+15
if b.y>HEIGHT then
table.remove(msl,a)
end
for c,d in pairs(msl2) do
ellipse( d.x,d.y,6,6) --fire
d.y=d.y-15
if d.y<0 then
table.remove(msl2,c)
end
end
end
end
function touched(t)
if t.state==BEGAN then
if t.y<HEIGHT/2 then
-- insert a new missle for main object
table.insert(msl,vec2(x,y+10))
end
end
if t.state==BEGAN then
if t.y>HEIGHT/2 then
table.insert(msl2,vec2(xx,yy+10))
end
end
if t.state==MOVING then
if t.y<HEIGHT/2 then
x=x+t.deltaX
y=y+t.deltaY
else
xx=xx+t.deltaX
yy=yy+t.deltaY
end
end
end