Created
October 4, 2013 16:03
-
-
Save anonymous/6828364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
supportedOrientations(PORTRAIT_ANY) | |
function setup() | |
displayMode(FULLSCREEN) | |
sonido = 0 | |
sonido2 = 0 | |
CODEA = readImage("Cargo Bot:Codea Icon") | |
touches = {} | |
---- Bolas cayendo usando gravedad (vec3) ---- | |
maxB = 10 | |
caida = {} | |
paredes() | |
---- SHADERS ----- | |
m = mesh() | |
n = mesh() | |
m.texture = CODEA | |
-- p.texture = juve | |
n.texture = Background | |
m.shader = shader("Effects:Ripple") | |
n.shader = shader("Effects:Ripple") | |
-- p.shader = shader("Effects:Ripple") | |
o = m:addRect(0,0,0,0) | |
oo = n:addRect(0,0,0,0) | |
-- ooo = p:addRect(0,0,0,0) | |
end | |
-- function for testing balls -- | |
function pelotas(x,y) | |
local ratio = 7 | |
local circle = physics.body(CIRCLE,ratio) | |
circle.restitution = 0.8 | |
circle.gravityScale = 5+math.random() | |
circle.x = x | |
circle.y = y | |
return circle | |
end | |
function paredes () | |
pared_1 = physics.body(EDGE,vec2(0,0),vec2(WIDTH,0)) | |
pared_1.type = STATIC | |
pared_2 = physics.body(EDGE,vec2(0,0),vec2(0,HEIGHT)) --PARED IZQUIERDA | |
pared_2.type = STATIC | |
pared_4 = physics.body(EDGE,vec2(WIDTH,0),vec2(WIDTH,HEIGHT)) | |
pared_4.type = STATIC | |
end | |
function touched(touch) | |
local x = WIDTH/2 | |
local y = HEIGHT/2+300 | |
--y = touch.y | |
if touch.y >= HEIGHT/2+70 and touch.y <= HEIGHT/2+400 and | |
touch.x >= WIDTH/2-190 and touch.x <= WIDTH/2+190 then | |
sound(DATA, "ZgJASTxlTFNwUhpATsK+Ps98UD64nCs+EAB/UipHRUBNX0Bj") | |
m.shader.freq = 0.7 | |
for i = 1 , maxB do | |
table.insert(caida,pelotas(x+i,y)) | |
end | |
elseif #touches==2 then | |
m.shader.freq = 0 | |
end | |
for i = 1 ,#touches do | |
if touch.id == touches[i].z then | |
touches[i] = vec4(touch.x,touch.y,touch.id,touch.state) | |
return | |
end | |
end | |
table.insert(touches , vec4(touch.x,touch.y,touch.id,touch.state)) | |
end | |
function draw() | |
background(190,245,223,900) | |
sprite("Cargo Bot:Dialogue Box",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT) | |
m.texture = CODEA | |
local a,b = spriteSize(CODEA) | |
m:setRect(o,WIDTH/2,HEIGHT/2+222,a+120,b+110) | |
m.shader.time = ElapsedTime | |
m:draw() | |
gravedad = vec3(Gravity.x,Gravity.y,Gravity.z) | |
--if CurrentTouch.tapCount == 1 then | |
physics.gravity(gravedad) | |
for i,body in ipairs(caida) do | |
fill(255,570,254,156) | |
sprite("Cargo Bot:Codea Icon",body.x,body.y,24) | |
--end | |
end | |
-- sprite("Dropbox:codea", WIDTH/2, HEIGHT/2-900) | |
showText("(Touch the codea icon)",WIDTH/2,HEIGHT/2-52) | |
sprite("Cargo Bot:Made With Codea",WIDTH/2,HEIGHT/2-160,260) | |
showText("exit: touch whit 4 fingers",WIDTH/2,HEIGHT/2-290) | |
--sprite("Cargo Bot:Codea Icon",WIDTH/2,HEIGH | |
if #touches==4 then | |
close() | |
end | |
if CurrentTouch.state == BEGAN then | |
if CurrentTouch.tapCount == 2 then | |
sound(DATA,"ZgNADQA9PUJCQAthAAAAALicKz7PfFA+fwBZRkA+QzM+PDtD") | |
gamestate = PLAYING | |
end | |
end | |
end | |
function showText(str , x , y ) | |
pushStyle() | |
fill(0, 5, 0, 255) | |
font("Noteworthy-Bold") | |
fontSize(24) | |
text(str,x,y) | |
popStyle() | |
end | |
function showText2(str , x , y ) | |
pushStyle() | |
fill(255, 255, 255, 255) | |
font("Noteworthy-Bold") | |
fontSize(18) | |
text(str,x,y) | |
popStyle() | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment