Hey guys does anyone have a program for a simple game i could have that you coukd share with me thanks
Try the step by step projects on the wiki link above…
Look on Codea Community
look in CC(codea Community) there are many proyects . You can download any proyect you want @Tobatar
Here’s something I had laying around if anyone wants to do anything with it. Drag the ball down, then release it at the targets. There’s a lot more to do if you want to fix it up.
displayMode(FULLSCREEN)
function setup()
hit=0
miss=0
vx=0 --x velocity
vy=0 --y velocity
ball=vec2(WIDTH/2,200)
targets={}
for z=1,5 do -- setvup 5 targets
table.insert(targets,vec2(math.random(WIDTH+10,WIDTH+100),
math.random(HEIGHT-300,HEIGHT-50)))
end
stroke(255)
strokeWidth(4)
end
function draw()
background(40, 40, 50)
fill(255)
text("Hit "..hit.." Missed "..miss,WIDTH/2,1000)
if move then -- move targets
for a,b in pairs(targets) do
ellipse(b.x,b.y,30)
b.x=b.x-1
if b.x<0 then -- target went off left side of screen
b.x=WIDTH+20
miss=miss+1
end
end
end
ellipse(ball.x+vx,ball.y+vy,20) -- draw ball
ellipse(WIDTH/2,200,5) -- draw dot
if ball.y>=200 then -- draw line from edge to edge
line(0,200,WIDTH,200)
else
line(0,200,ball.x,ball.y) -- draw line with ball
line(ball.x,ball.y,WIDTH,200)
end
if vx>0 or vy>0 then
ball.x=ball.x+vx -- move ball
ball.y=ball.y+vy
-- check if ball hits targets
v1=vec2(ball.x,ball.y)
for a,b in pairs(targets) do
if v1:dist(vec2(b.x,b.y)) <20 then
hit=hit+1
sound(SOUND_EXPLODE, 11412)
b.x=WIDTH+10
ball.x=WIDTH/2
ball.y=200
vx=0
vy=0
end
end
-- chech if ball is off screen
if ball.x<0 or ball.x>WIDTH or ball.y<0 or ball.y>HEIGHT then
miss=miss+1
ball.x=WIDTH/2
ball.y=200
vx=0
vy=0
end
end
end
function touched(t)
if ball.y<=250 then -- ball at starting position
if t.state==BEGAN or t.state==MOVING then
ball.x=t.x
ball.y=t.y
move=true -- start targets moving
end
end
if t.state==ENDED and ball.y<200 then
-- calculate ball direction
v1=vec2(WIDTH/2-ball.x,200-ball.y)
v1=v1:normalize()
vx=v1.x*15
vy=v1.y*15
end
end