Any constructive criticism please give me your feedback.
Thanks
function setup()
img=readImage("Project:Background")
img2=readImage("Dropbox:Bird")
img3=readImage("Dropbox:Bottom Pipe")
img4=readImage("Dropbox:Top Pipe")
birdX=100
birdY=HEIGHT/2
birdspeed=1
pipeX=WIDTH
pipeY=math.random(-15,18)*10
pipespeed=-4
pipeW=pipeX+325
pipeZ=math.random(-15,18)*10
pipeA=pipeW+325
pipeB=math.random(-15,18)*10
score=0
gamestate=1
crash=0
end
function draw()
sprite(img,WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
if gamestate==1 then
birdspeed=birdspeed-0.175
birdY=birdY+birdspeed
end
sprite("Dropbox:flappy",birdX,birdY,125)
if birdY<=30 then
gamestate=crash
end
if birdY>=HEIGHT-30 then
birdY=HEIGHT-30
birdspeed=-1
end
pipeX=pipeX+pipespeed
sprite(img3,pipeX,pipeY,70,500)
sprite(img4,pipeX,pipeY+700,70,500)
if pipeX<=-70 then
pipeX=pipeA+325
pipeY=math.random(-15,18)*10
score=score+1
end
pipeW=pipeW+pipespeed
sprite(img3,pipeW,pipeZ,70,500)
sprite(img4,pipeW,pipeZ+700,70,500)
if pipeW<=-70 then
pipeW=pipeX+325
pipeZ=math.random(-15,18)*10
score=score+1
end
pipeA=pipeA+pipespeed
sprite(img3,pipeA,pipeB,70,500)
sprite(img4,pipeA,pipeB+700,70,500)
if pipeA<=-70 then
pipeA=pipeW+325
pipeB=math.random(-15,18)*10
score=score+1
end
function touched(touch)
if touch.state==BEGAN then
birdspeed=birdspeed+7
end
if gamestate==crash and touch.state==BEGAN then
pipeX=WIDTH
pipeW=pipeX+325
pipeA=pipeW+325
pipeY=math.random(-15,18)*10
pipeZ=math.random(-15,18)*10
pipeB=math.random(-15,18)*10
birdY=HEIGHT/2
score=0
pipespeed=-4
birdspeed=1
gamestate=1
end
end
if birdX>=pipeX-65 and birdX<=pipeX+65 and birdY<=pipeY+250 then
gamestate=crash
end
if birdX>=pipeX-65 and birdX<=pipeX+65 and birdY>=pipeY+450 then
gamestate=crash
end
if birdX>=pipeW-65 and birdX<=pipeW+65 and birdY<=pipeZ+250 then
gamestate=crash
end
if birdX>=pipeW-65 and birdX<=pipeW+65 and birdY>=pipeZ+450 then
gamestate=crash
end
if birdX>=pipeA-65 and birdX<=pipeA+65 and birdY<=pipeB+250 then
gamestate=crash
end
if birdX>=pipeA-65 and birdX<=pipeA+65 and birdY>=pipeB+450 then
gamestate=crash
end
if gamestate==crash then
birdspeed=birdspeed*0
pipespeed=pipespeed*0
text("YOU FAILED! You scored "..(score).." points.",WIDTH/2,350)
end
end