function setup()
x1=WIDTH/2
x2=WIDTH/2
speedX=5
Hullx=WIDTH/2
Hully=20
y1=165
y2=225
col1 = colr()
col2 = clor()
col3 = corl()
p=math.random(1,4)
hullWidth=290
dropperWidth=290
dropperx=math.random(0,WIDTH-290)
droppery=HEIGHT-60
speeddrop=1
Score=0 end
function draw()
background(27, 151, 212, 255)
x2=x2-speedX
droppery=droppery-speeddrop
if droppery>=y2+55 and droppery<=y2+65 and dropperx<=x2+3 and dropperx>=x2-3 then Score=Score+4
pushStyle()
fill(0, 0, 0, 255) -- the scores text will have color black
font("TimesNewRomanPS-BoldMT") -- the font type for the score number
fontSize(80) -- the font size for the score number
text("PERFECT!",WIDTH/2,500) -- the position of the text of score
popStyle()
sound() end
if droppery>=y2+55 and droppery<=y2+65 and dropperx~=x2 and dropperx>x2 and WIDTH==1024
then dropperWidth=dropperWidth-math.abs(dropperx-x2)
hullWidth=hullWidth-math.abs(dropperx-x2)
droppery=HEIGHT-60
dropperx=math.random(0,WIDTH-290)
speeddrop=math.random(1,2)
Score=Score+1 end
if droppery>=y2+55 and droppery<=y2+65 and dropper~=x2 and dropperx<x2 and WIDTH==1024
then dropperWidth=dropperWidth-math.abs(x2-dropperx)
hullWidth=hullWidth-math.abs(x2-dropperx)
droppery=HEIGHT-60
dropperx=math.random(0,WIDTH-290)
speeddrop=math.random(1,2)
Score=Score+1 end
if droppery>=y2+55 and droppery<=y2+65 and dropperx~=x2 and dropperx>x2 and WIDTH==768
then dropperWidth=dropperWidth-math.abs(dropperx-x2)
hullWidth=hullWidth-math.abs(dropperx-x2)
droppery=HEIGHT-60
dropperx=math.random(0,WIDTH-290)
speeddrop=math.random(1,5)
Score=Score+1 end
if droppery>=y2+55 and droppery<=y2+65 and dropper~=x2 and dropperx<x2 and WIDTH==768
then dropperWidth=dropperWidth-math.abs(x2-dropperx)
hullWidth=hullWidth-math.abs(x2-dropperx)
droppery=HEIGHT-60
dropperx=math.random(0,WIDTH-290)
speeddrop=math.random(1,5)
Score=Score+1 end
if x2>=-15 and x2<=15 then speedX=-5 end
if x2>=WIDTH-hullWidth then speedX=5 end
if dropperWidth<=0 then sprite("Project:Custom Image", WIDTH/2, HEIGHT/2,WIDTH,HEIGHT) end
if p==1 then sprite("Space Art:Part Gray Hull 2",Hullx,Hully,360,300) end
if p==2 then sprite("Space Art:Part Green Hull 2",Hullx,Hully,360,300) end
if p==3 then sprite("Space Art:Part Red Hull 2",Hullx,Hully,360,300) end
if p==4 then sprite("Space Art:Part Yellow Hull 2",Hullx,Hully,360,300) end
pushStyle()
fill(col1)
rect(x1-146,y1,290,60)
popStyle()
pushStyle()
fill(col2)
rect(x2,y2,hullWidth,60)
popStyle()
pushStyle()
fill(col3)
rect(dropperx,droppery,dropperWidth,60)
popStyle()
pushStyle()
fill(0, 0, 0, 255) -- the scors text will have color black
font("ArialMT") -- the font type for the score number
fontSize(80) -- the font size for the score number
text(Score,WIDTH/2+5,27) -- the position of the text of score
popStyle()
end
function colr()
a = math.random(0,255)
b = math.random(0,255)
c = math.random(0,255)
return color(a,b,c)
end
function clor()
d = math.random(0,255)
e = math.random(0,255)
f = math.random(0,255)
return color(d,e,f)
end
function corl()
g = math.random(0,255)
h = math.random(0,255)
i = math.random(0,255)
return color(g,h,i)
end
function touched (touch)
if touch.state==BEGAN and speedX==5 then speedX=0.005 end
if touch.state==BEGAN and speedX==-5 then speedX=-0.005 end
if touch.state==ENDED and speedX==0.005 then speedX=5 end
if touch.state==ENDED and speedX==-0.005 then speedX=-5 end
if dropperWidth<=0 and touch.state==BEGAN then restart() end
end
This is just the alpha of the game, its definately not done just yet but the game is playable and I would love to hear what you guys think about it