Skip to content

Instantly share code, notes, and snippets.

@CodeaLuis
Created November 17, 2013 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeaLuis/7516217 to your computer and use it in GitHub Desktop.
Save CodeaLuis/7516217 to your computer and use it in GitHub Desktop.
Codea Project Gist Created with AutoGist
AutoGist Tab Order Version: 2.2.8
------------------------------
This file should not be included in the Codea project.
#Main
#effects
#SecretodeUnicornio
#botones
#loadPictures
#viajeLuna
Buttons = class()
--> A SIMPLE BUTTON CLASS
function Buttons:init(x,y,txt,funct,Mode,l,h)
self.x = x
self.y = y
fontSize(30)
font("Georgia-Bold")
self.txt = txt
self.Sl,self.Sh = textSize(self.txt)
self.funct = funct
self.l=l or self.Sl+20
self.h=h or self.Sh+20
self.mode=Mode
self.colour=color(255,255,255, 255)
end
function Buttons:draw()
pushStyle()
fontSize(30)
font("Copperplate-Bold")
fill(self.colour)
if self.mode then
text(self.txt,self.x+self.l/2,self.y+self.h/2)
else
text(self.txt,self.x,self.y)
end
popStyle()
end
function Buttons:touched(touch)
if self.mode then
self.tx=touch.x-self.l/2
self.ty=touch.y-self.h/2
else
self.tx = touch.x
self.ty = touch.y
end
if self.tx<=self.x + self.l/2 and self.tx>=self.x - self.l/2 and
self.ty>=self.y - self.h/2 and self.ty<=self.y + self.h/2 then
if touch.state==BEGAN then
self.colour=color(251, 251, 251, 255)
self.press=true
elseif touch.state == ENDED and self.press then
self.colour=color(255, 255, 255, 255)
self.funct()
sound(SOUND_PICKUP, 89899)
end
else
self.colour=color(0, 0, 0, 255)
end
if touch.state==ENDED then
self.colour=color(0, 0, 0, 255)
self.press=false
end
end
effects = class()
function effects:init(x)
-- you can accept and set parameters here
self.EffectAlpha = 135
tween(4,self,{EffectAlpha = 0})
end
function effects:draw()
-- Codea does not automatically call this metho
fill(5,5,5,self.EffectAlpha)
rect(650,-3,100,1014)
sprite("Cargo Bot:Play Solution Icon",WIDTH/2+330,HEIGHT/2,self.EffectAlpha/2)
end
function effects:touched(touch)
-- Codea does not automatically call this method
end
effectLeft = class()
function effectLeft:init()
self.EffectAlphas = 185
tween(3,self,{EffectAlphas = 0})
self.a = -70
end
function effectLeft:draw()
fill(5,5,5,self.EffectAlphas)
rect(1,-3,100,1014)
sprite("Cargo Bot:Play Solution Icon",WIDTH/2-334,HEIGHT/2,self.a,self.EffectAlphas/2)
end
f = class()
function f:LoadImages()
imageStatus='Ready' --tells draw it's ok to draw the scene (will be turned off if we have to download images)
output.clear()
--pass through Codea name of image and internet url
--not in Codea, will be downloaded and saved
img1=LoadImage('Dropbox:pagina1','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0066_zps1abe0def.png')
img2=LoadImage('Dropbox:pagina2','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0067_zps9f30049c.png')
img3=LoadImage('Dropbox:pagina3','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0069_zps9f3719b7.png')
img4=LoadImage('Dropbox:pagina4','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0070_zpsee0f9654.png')
img5=LoadImage('Dropbox:pagina5','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0071_zpsa8317c2c.png')
img6=LoadImage('Dropbox:pagina6','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0072_zps3702633a.png')
img7=LoadImage('Dropbox:pagina7','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0073_zps01461037.png')
ima8=LoadImage('Dropbox:pagina8','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0073_zps01461037.png')
---------------------------------------------------------------------------------------------------------------------
--SEGUNDO COMIC
---------------------------------------------------------------------------------------------------------------------
img_1=LoadImage('Dropbox:Moon1','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0079_zps071fa761.png')
img_2=LoadImage('Dropbox:Moon2','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0080_zps2afe0ba9.png')
img_3=LoadImage('Dropbox:Moon3','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0081_zps58345537.png')
img_4=LoadImage('Dropbox:Moon4','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0082_zps28dc421f.png')
img_5=LoadImage('Dropbox:Moon5','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0083_zpsd1221de2.png')
--------------------------------------------------------------------------------------------------------------------
--TERCER COMIC
--------------------------------------------------------------------------------------------------------------------
imagen1=LoadImage('Dropbox:America1','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0084_zpscae7e7af.png')
imagen2=LoadImage('Dropbox:America2','http://i780.photobucket.com/albums/yy81/luismigueldirauso/IMG_0085_zps22c3e4df.png')
--if imageStatus=='Ready' then setup2() end
end
function LoadImage(fileName,url)
local i=readImage(fileName)
if i~=nil then return i end
--not found, we need to download, add to queue (ie table)
if imageTable==nil then imageTable={} end
imageTable[#imageTable+1]={name=fileName,url=url}
print('Queueing',fileName)
imageStatus='Loading'
--if the first one, go ahead and download
if #imageTable==1 then
http.request(imageTable[1].url,ImageDownloaded)
print('loading',imageTable[1].name)
end
end
--saves downloaded images
function ImageDownloaded(img)
print(imageTable[1].name,'loaded')
saveImage(imageTable[1].name,img) --save
table.remove(imageTable,1)
--load next one if we have any more to do
if #imageTable>0 then
http.request(imageTable[1].url,ImageDownloaded)
print('loading',imageTable[1].name)
else
LoadImages()
end
end
VERSION = "2.2.8" --Do not edit this
PROJECTNAME = "AutoGist" --Do not change this, your project should be named AutoGist
--/*
BUILD = false
--The name of the project must match your Codea project name if dependencies are used.
--Project: COMIC (TINTIN)
--Version: Alpha 3.3
--Comments:
displayMode(FULLSCREEN)
supportedOrientations(PORTRAIT)
function setup()
images = f()
images:LoadImages()
z = comic1()
t = comic2()
------------------------------
--> comic1 (secret of unicor)
------------------------------
PhysicsBodies = {}
page2 = Buttons(WIDTH/2-150,HEIGHT/2+100,"El Secreto del \n Unicornio",nextPage)
page3 = Buttons(WIDTH/2+150,HEIGHT/2+110,"Destino la Luna",Comic2)
page4 = Buttons(WIDTH/2-160,HEIGHT/2-355,"Tintin en America",nil)
page5 = Buttons(WIDTH/2+160,HEIGHT/2-371,"Las 7 bolas de \n cristal",nil)
end
function draw()
background(40, 40, 50)
sprite("Cargo Bot:Game Upper BG",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)
strokeWidth(0)
sprite(img1,WIDTH/2-160,HEIGHT/2+300,240)
sprite(img_1,WIDTH/2+160,HEIGHT/2+300,240)
sprite(imagen1,WIDTH/2-160,HEIGHT/2-170,240)
sprite(imagen2,WIDTH/2+160,HEIGHT/2-170,240)
page2:draw()
page3:draw()
page4:draw()
page5:draw()
if GameState == "tintin_1" then
z:draw()
elseif GameState == "tintin_2" then
t:draw()
elseif GameState == "Selection" then
draw()
end end
function touched(touch)
page2:touched(touch) page3:touched(touch)
if GameState == "tintin_1" then
z:touched(touch)
elseif GameState == "tintin_2" then
t:touched(touch)
elseif GameState == "Selection" then
touched(touch)
end end
function nextPage()
ChangeState("tintin_1",z.init)
end
function Comic2()
ChangeState("tintin_2",t.setup)
end
function ChangeState(State,funct)
for k,v in pairs(PhysicsBodies) do
v:destroy()
v=nil end
PhysicsBodies={}
funct()
GameState=State
end
comic1 = class()
function comic1:init()
Scene(1,firs_page)
Scene(2,second_page)
Scene(3,page_3)
Scene(4,page_4)
Scene(5,page_5)
Scene(6,page_6)
Scene(7,page_7)
Scene.parameter()
end
function comic1:draw()
background(0)
Scene.draw()
end
function comic1:touched(touch)
Scene.touched(touch)
end
---------------------
--> Usamos metatable
---------------------
Scene = {} --> Identificador para hacer llamado a las otras pantallas
scene = nil
scenes = {}
currentscene = nil
name_S = {}
setmetatable(Scene , { __call = function(_,name,funcion)
if not currentscene then
currentscene = 1
scene = scenes[currentscene]
end
table.insert(scenes,funcion)
name_S[name] = #scenes
changes = nil
end})
----------------------
--> PARAMETER.INTEGER
----------------------
Scene.parameter = function() parameter.integer("changes",1,#scenes,currentscene,
function(var)
Scene.change(var) end
) end
function Scene.change(name)
ActualScene = nil
if type(name) == "string" then
currentscene = name_S[name]
elseif type(name) == "number" then
currentscene = name
else currentscene = 1
end
ActualScene = scenes[currentscene]
ActualScene:init()
end
Scene.draw = function()
ActualScene:draw()
end
Scene.touched = function(t)
if ActualScene.touched then
ActualScene:touched(t)
end
end
------------------------
--> SECOND CLASS
--> TO CALL A NEW STATE
------------------------
firs_page = class()
function firs_page:init(x)
q = effects()
q:init()
s = 0
end
function firs_page:draw()
background(225)
fontSize(50)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img1,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
--q:draw()
end
end
function firs_page:touched(touch)
if touch.x >= WIDTH/2 and touch.state == ENDED then
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
Scene.change(2)
end
end
second_page = class()
function second_page:init()
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
-----------------
--> ALPHA EFFECT
-----------------
self.efecto = 36
tween(0.3,self,{efecto = 0})
end
function second_page:draw()
background(155)
sprite(img2,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
fill(0,0,0,self.efecto)
sprite(img1,IMG.x,IMG.y)
popStyle()
end
function second_page:touched(touch)
if touch.x > WIDTH/2 and touch.state == ENDED then
Scene.change(3)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif touch.x < WIDTH/2 - 290 and touch.state == ENDED then
Scene.change(1)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
page_3 = class()
function page_3:init()
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function page_3:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img3,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img2)
popStyle()
end
function page_3:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
Scene.change(4)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
Scene.change(2)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
--------------------
--> PAGE 4
--------------------
page_4 = class()
function page_4:init(x)
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function page_4:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img4,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img3)
popStyle()
end
function page_4:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
Scene.change(5)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
Scene.change(3)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
-----------------
--> PAGE 5
-----------------
page_5 = class()
function page_5:init(x)
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function page_5:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img5,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img4)
popStyle()
end
function page_5:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
Scene.change(6)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
Scene.change(4)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
-----------------
--> PAGE 6
-----------------
page_6 = class()
function page_6:init(x)
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function page_6:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img6,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img5)
popStyle()
end
function page_6:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
Scene.change(7)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
Scene.change(5)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
page_7 = class()
function page_7:init(x)
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function page_7:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img7,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img6)
popStyle()
end
function page_7:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
Scene.change(1)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
Scene.change(6)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
comic2 = class()
function comic2:setup()
estado(1,_1)
estado(2,_2)
estado(3,_3)
estado(4,_4)
estado(5,_5)
estado(6,_6)
estado(7,_7)
estado.parameter()
end
function comic2:draw()
background(0)
estado.draw()
end
function comic2:touched(touch)
estado.touched(touch)
end
---------------------
--> Usamos metatable
---------------------
estado = {} --> Identificador para hacer llamado a las otras pantallas
a = nil
b = {}
estadoActual = nil
nombreEstado = {}
setmetatable(estado , { __call = function(_,nombre,var)
if not estadoActual then
estadoActual = 1
a = b[estadoActual]
end
table.insert(b,var)
nombreEstado[nombre] = #b
cambio = nil
end})
----------------------
--> PARAMETER.INTEGER
----------------------
estado.parameter = function() parameter.integer("cambio",1,#b,estadoActual,
function(varr)
estado.change(varr) end
) end
function estado.change(nombre)
actual = nil
if type(nombre) == "string" then
estadoActual = nombreEstado[nombre]
elseif type(nombre) == "number" then
estadoActual = nombre
else estadoActual = 1
end
actual = b[estadoActual]
actual:init()
end
estado.draw = function()
actual:draw()
end
estado.touched = function(t)
if actual.touched then
actual:touched(t)
end
end
------------------------
--> SECOND CLASS
--> TO CALL A NEW STATE
------------------------
_1 = class()
function _1:init()
q = effects()
q:init()
s = 0
end
function _1:draw()
background(225)
fontSize(50)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img_1,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
--q:draw()
end
end
function _1:touched(touch)
if touch.x >= WIDTH/2+240 and touch.state == ENDED then
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
estado.change(2)
end
end
_2 = class()
function _2:init()
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
-----------------
--> ALPHA EFFECT
-----------------
self.efecto = 36
tween(0.3,self,{efecto = 0})
end
function _2:draw()
background(155)
sprite(img_2,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
fill(0,0,0,self.efecto)
sprite(img_1,IMG.x,IMG.y)
popStyle()
end
function _2:touched(touch)
if touch.x > WIDTH/2 and touch.state == ENDED then
estado.change(3)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif touch.x < WIDTH/2 - 290 and touch.state == ENDED then
estado.change(1)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
_3 = class()
function _3:init()
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function _3:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img_3,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img_2)
popStyle()
end
function _3:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
estado.change(4)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
estado.change(2)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
--------------------
--> PAGE 4
--------------------
_4 = class()
function _4:init(x)
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function _4:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img_4,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img_3)
popStyle()
end
function _4:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
estado.change(5)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
estado.change(3)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
-----------------
--> PAGE 5
-----------------
_5 = class()
function _5:init(x)
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function _5:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img_5,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img_4)
popStyle()
end
function _5:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
estado.change(6)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
estado.change(4)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
-----------------
--> PAGE 6
-----------------
_6 = class()
function _6:init(x)
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function _6:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img6,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img_5)
popStyle()
end
function _6:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
estado.change(7)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
estado.change(5)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
_7 = class()
function _7:init(x)
q = effects()
q:init()
e = effectLeft()
e:init()
IMG = vec2(WIDTH/2,HEIGHT/2)
tween(1.5,IMG,{x = WIDTH/2-800,y = HEIGHT/2},
{easing = tween.easing.linear
})
end
function _7:draw()
background(255)
text("Espera...",WIDTH/2,HEIGHT/2)
sprite(img7,WIDTH/2,HEIGHT/2)
if CurrentTouch.x > WIDTH/2 + 290 then
q:draw()
end
pushStyle()
translate(IMG.x,IMG.y)
sprite(img6)
popStyle()
end
function _7:touched(t)
if t.state == ENDED and t.x > WIDTH/2 + 290 then
estado.change(1)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
elseif t.state == ENDED and t.x <= WIDTH/2 - 290 then
estado.change(6)
sound(DATA, "ZgNAc2taYFhASUBATE2bPgAAAADYdz8+AABAf0BGQEBAQEBA")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment