Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x=WIDTH/2
- game=0
- y=HEIGHT/2
- xx=10
- yy=10
- movfact=10
- mivfact = 1
- px=WIDTH -101/2
- py=HEIGHT -171/2
- ex= 101/2
- ey= HEIGHT -171/2
- mov=20
- i=500
- -- Use this function to perform your initial setup
- function setup()
- displayMode(FULLSCREEN_NO_BUTTONS)
- ey = HEIGHT -101/2
- -- print("Hello World!")
- parameter("movfact", 1 , 100)
- parameter("mivfact",0,100)
- egg={}
- -- table.insert(egg,vec2(300,200))
- block = image(20,20)
- for i=1,20 do for j=1,20 do block:set(i,j,255,0,0,255) end end
- one= readLocalData("one",0)
- two = readLocalData("two",0)
- three= readLocalData("three",0)
- four= readLocalData("four",0)
- five = readLocalData("five",0)
- six = readLocalData("six",0)
- seven= readLocalData("seven",0)
- eight = readLocalData("eight",0)
- nine = readLocalData("nine",0)
- ten = readLocalData("ten",0)
- end
- -- This function gets called once every frame
- function draw()
- if game==0 then
- background()
- sound(SOUND_RANDOM)
- end
- if game==3 then
- -- displayMode(STANDARD)
- background()
- sprite("SpaceCute:Collision Circle",WIDTH/2,HEIGHT/2)
- end
- if game==1 then
- -- displayMode(FULLSCREEN_NO_BUTTONS)
- px=WIDTH -171/2
- py=HEIGHT -101/2
- -- This sets the background color to black
- i = i + 1
- -- mivfact = mivfact + 0.1
- background(0, 0, 0)
- sprite("Planet Cute:Ramp South",ex,ey)
- sprite("Planet Cute:Wood Block",px,py)
- sprite("Tyrian Remastered:Blimp Boss",x,y)
- for z=1,i/500 do monmove() end
- sprite("Tyrian Remastered:Chest Mecha",xx,yy)
- x=x-(x%1)
- y=y-(y%1)
- xx=xx-(xx%1)
- yy=yy-(yy%1)
- if(i%10==0) then sprite(block,xx,yy)end
- if(i%100==0)then
- table.insert(egg,vec2(xx,yy))
- sound(SOUND_PICKUP)
- end
- for key,i in pairs(egg)do
- mivfact=0.5
- -- sprite(block,i.x,i.y)
- ll=yy
- ii=xx
- yy=i.y
- xx=i.x
- monmove()
- i.x=xx
- i.y=yy
- xx=ii
- yy=ll
- sprite(block,i.x,i.y)
- end
- mivfact=1
- if x==xx and y==yy then closee() end
- -- if i==2500 then woon() end
- -- Do your drawing here
- end
- end
- function touched (touch)
- if game==0 and touch.state==ENDED then game = 1 end
- if game==3 and touch.state==ENDED then game =1
- for i=1,50 do sound(SOUND_HIT) end
- end
- if game==1 then
- if touch.x >=px -171/2 and touch.y >= py -101/2 then
- game=3
- else
- if touch.x <=ex +171/2 and touch.y >= ey -101/2 then
- closee()
- else
- if touch.x < x then zx = x - movfact end
- if touch.x > x then zx = x + movfact end
- if touch.y < y then zy = y - movfact end
- if touch.y > y then zy = y + movfact end
- point =vec2(zx,zy)
- if(ic(point))then
- --crash with egg
- else
- l=vec2(x,y)
- zx=touch.x-x
- zy=touch.y-y
- q=vec2(zx,zy)
- l = l + q*movfact*DeltaTime
- x=l.x
- y=l.y
- end
- end
- end
- end
- end
- function monmove()
- if xx>x then xx = xx - mivfact end
- if yy>y then yy = yy - mivfact end
- if xx<x then xx = xx + mivfact end
- if yy<y then yy = yy + mivfact end
- end
- function closee()
- background()
- sprite("Tyrian Remastered:Blimp Boss Destroyed",x,y)
- for i = 0,10 do
- sprite(block,200+i*mov , 600 -i*mov)
- sprite(block,400-i*mov , 600-i*mov)
- end
- for i = 1,50 do
- sound(SOUND_EXPLODE,1)
- end
- highscore()
- game=2
- -- close()
- end
- function woon()
- background()
- sprite("Tyrian Remastered:Blimp Boss",x,y)
- for i = 0,10 do
- if i>5 then sprite(block,300-i*mov , 300 +i*mov) end
- sprite(block,400-i*mov , 600-i*mov)
- end
- for i=1,50 do sound(SOUND_BLIT) end
- -- close()
- end
- function ic(point)
- for i,v in pairs(egg) do
- if icc(point,v) then
- return true
- end
- end
- return false
- end
- function icc(point,v)
- c=vec2(20,20)
- ll = v - c * 0.5
- ur = v + c * 0.5
- if point.x > ll.x and point.x < ur.x and
- point.y > ll.y and point.y < ur.y then
- return true
- end
- return false
- end
- function highscore()
- displayMode(STANDARD)
- -- background()
- i=i-500
- if i > one then
- if i> two then
- if i> three then
- if i > four then
- if i > five then
- if i> six then
- if i> seven then
- if i>eight then
- if i>nine then
- if i> ten then
- one=two
- two=three
- three=four
- four=five
- five=six
- six=seven
- seven=eight
- eight=nine
- nine=ten
- ten=i
- print("new recorde!")
- else
- one=two
- two=three
- three=four
- four=five
- five=six
- six=seven
- seven=eight
- eight=nine
- nine=i
- end
- else
- one=two
- two=three
- three=four
- four=five
- five=six
- six=seven
- seven=eight
- eight =i
- end
- else
- one=two
- two=three
- three=four
- four=five
- five=six
- six=seven
- seven=i
- end
- else
- one=two
- two=three
- three=four
- four=five
- five=six
- six=i
- end
- else
- one=two
- two=three
- three=four
- four=five
- five=i
- end
- else
- one=two
- two=three
- three=four
- four=i
- end
- else
- one=two
- two=three
- three=i
- end
- else
- one=two
- two=i
- end
- else
- one=i
- end
- else
- print("sry , you didnt got a new high score")
- end
- print("your record is",i)
- print(one)
- print(two)
- print(three)
- print(four)
- print(five)
- print(six)
- print(seven)
- print(eight)
- print(nine)
- print(ten)
- saveLocalData("one",one)
- saveLocalData("two",two)
- saveLocalData("three",three)
- saveLocalData("four",four)
- saveLocalData("five",five)
- saveLocalData("six",six)
- saveLocalData("seven",seven)
- saveLocalData("eight",eight)
- saveLocalData("nine",nine)
- saveLocalData("ten",ten)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement