In 2 of march i well uplode this app in the app store and in the google play pleas i want a helpe
This is the code
--# Main
--# CloudLevels
CloudLevels = class()
CULLPADDING = 300
function CloudLevels:init() -- you can accept and set parameters here
self.clouds = {}
self.nextCloudHeight = 90
end
function CloudLevels:generateNextCloud()
cloud = Cloud()
cloud.position = vec2(math.random(-WIDTH/2,WIDTH/2), self.nextCloudHeight)
table.insert(self.clouds, cloud)
self.nextCloudHeight = self.nextCloudHeight + math.random(150,300)
end
function CloudLevels:cullClouds(floor)
for i,v in ipairs(self.clouds) do
if v.position.y < floor then
table.remove(self.clouds,i)
end
end
end
function CloudLevels:isColliding(pos)
for i,v in ipairs(self.clouds) do
if v:isColliding(pos) then
return true
end
end
return false
end
function CloudLevels:update(cam)
curHeight = -cam.y + HEIGHT + CULLPADDING
if curHeight > self.nextCloudHeight then
self:generateNextCloud()
end
self:cullClouds(-cam.y - CULLPADDING)
end
function CloudLevels:draw() -- Codea does not automatically call this method
for i,v in ipairs(self.clouds) do
v:draw()
end
end
function CloudLevels:touched(touch) -- Codea does not automatically call this method
end
--# Cloud
Cloud = class()
function Cloud:init() -- you can accept and set parameters here
self.shapes = {}
self.position = vec2(0,3)
-- Generate random cloud
numCircles = math.random(4, 5)
spacing = 30
for i = 1,numCircles do
x = i * spacing - ((numCircles/2)*spacing)
y = (math.random() - 0.5) * 30
rad = math.random(spacing, 2*spacing)
table.insert(self.shapes, {x=x, y=y, r=rad})
end
self.width = numCircles * spacing + spacing
end
function Cloud:isColliding(pos)
startp = self.position.x - self.width/2
endp = self.position.x + self.width/2
if pos.x < endp and pos.x > startp and
pos.y < (self.position.y + 30) and
pos.y > (self.position.y + 10) then
return true
end
return false
end
function Cloud:draw()
pushStyle()
pushMatrix()
translate(self.position.x, self.position.y)
noStroke()
ellipseMode(RADIUS)
fill(218, 221, 31, 255)
for i,s in ipairs(self.shapes) do
ellipse(s.x, s.y - 5, s.r)
end
fill(186, 205, 57, 255)
for i,s in ipairs(self.shapes) do
ellipse(s.x, s.y + 5, s.r)
end
popMatrix()
popStyle()
end
--# Super_sponge
Girl = class()
function Girl:init() -- you can accept and set parameters here
self.position = vec2(0,0)
self.velocity = vec2(0,0)
end
function Girl:jump(power)
sound(SOUND_JUMP)
local pow = power
if difficulty == "medium" then pow = pow - 12 end
if difficulty == "hard" then pow = pow - 14 end
self.velocity = self.velocity + vec2(0,pow)
end
function Girl:computeVelocity()
gravity = vec2(Gravity.x, math.min(Gravity.y,-1)):normalize()
gravity = gravity * 1
friction = math.min(self.position.y, 1)
return self.velocity + gravity * friction
end
function Girl:update()
self.position = self.position + self:computeVelocity()
-- Clamp y position
-- (so you don't go through ground)
self.position.y = math.max(self.position.y,0)
-- Clamp x position
self.position.x = math.max(self.position.x,-WIDTH/2)
self.position.x = math.min(self.position.x,WIDTH/2)
-- Dampen velocity
self.velocity = self.velocity * 0.98
end
function Girl:isFalling()
return self:computeVelocity().y < 0
end
function Girl:draw()
self:update()
pushMatrix()
translate(self.position.x, self.position.y)
sprite("Documents:sponge bob", 0, 0)
popMatrix()
end
--# Main
function setup()
displayMode(FULLSCREEN)
sprite("Documents:the vilig",WIDTH/2,HEIGHT/4)
clouds = CloudLevels()
girl = Girl()
girl.position = vec2(0, 0)
gameState = "menu"
difficulty = "play the game"
end
-- This function gets called once every frame
function draw()
if gameState == "menu" then
background(245, 255, 0, 57)
displayMode(FULLSCREEN)
font("Zapfino")
fontSize(40)
fill(33, 70, 219, 255)
text("Main Menu", WIDTH/2, 600)
noStroke()
ellipseMode(RADIUS)
fill(65, 141, 200, 61)
fill(27, 229, 141, 255)
rect(WIDTH /2 -103, 350,200,50)
rect(WIDTH /2 -103, 250,200,50)
rect(WIDTH -750 , 150,470,50)
rect(WIDTH -750 , 75,470,50)
font("SnellRoundhand-Black")
fill(50, 75, 175, 255)
fontSize(30)
text(" play the game", WIDTH/2 , 380)
text("credites", WIDTH/2 , 280 )
text("contact the developer of the game" , WIDTH/2, 180 )
text("contact the photos designer ", WIDTH/2,100 )
sprite("Documents:basset",WIDTH-159,HEIGHT-600)
-- sprite("Documents:sponge bob",WIDTH/2,HEIGHT/11)
sprite("Documents:basset",WIDTH-800,HEIGHT-380)
sprite("Documents:sandy",WIDTH-350,HEIGHT-300)
sprite("Documents:mrs",WIDTH-200,HEIGHT-200)
sprite("Documents:the vilige",WIDTH-150,HEIGHT-400)
sprite("Documents:r",WIDTH-700,HEIGHT-500)
sprite("Documents:r",WIDTH-100,HEIGHT-100)
sprite("Documents:the vilig",WIDTH-900,HEIGHT-600)
sprite("Documents:mrs",WIDTH-800,HEIGHT-150)
elseif gameState == "playing" then
background(0, 234, 255, 255)
displayMode(FULLSCREEN)
-- Center the camera on the girl character
camPos = vec2(WIDTH/2, math.min(HEIGHT/2 - girl.position.y, 144))
translate(camPos.x,camPos.y)
-- Draw ground
for i = 1,6 do
sprite("Documents:jelly fish", -WIDTH/2-70 + 125*i,2831)
end
clouds:update(camPos)
clouds:draw()
girl:draw()
if clouds:isColliding(girl.position) and girl:isFalling() then
girl:jump(math.random(9,67))
end
end
function touched(touch)
if gameState == "menu" then
if touch.state == ENDED then
if touch.y > 300 then
difficulty = "play the game"
gameState = "playing"
elseif touch.y > 200 then
difficulty = "credits"
gameState = "menu"
openURL( 'https:' .. '//www.youtube.com/watch?v=j2ovNrJmjPo' )
elseif touch.y > 100 then
difficulty = "contact the developer of the game"
gameState = "menu"
openURL( 'https://mohammadabumoosa.wordpress.com' )
elseif touch.y > 0 then
difficulty = "contact the photos designer"
gamestate = "menu"
openURL ( 'https://abumoosa.com')
end
elseif gameState == "playing" then
if touch.tapCount == 1 and girl.position.y == 0 then
girl:jump(40)
end
end
end
end
end