Blobby Blue code:
--# Main
-- This program was made by Adam9812. It is Public Domain.
-- Blobby Blue 2.1.1
function setup()
apple = readImage("Dropbox:Apple")
tnt = readImage("Dropbox:TNT")
rareApple = readImage("Dropbox:RareApple")
tree = readImage("Dropbox:Tree")
appleNumber = 0
saveAppleNumber = 0
tntNumber = 0
saveTNTNumber = 0
music("Game Music One:Zero")
print("Functiontime: The amount of time a spawn cycle lasts in seconds.")
print("Score: A measure of how well you're doing. Eating an apple raises it based off how long your functiontime is, while eating TNT subtracts 10 points.")
print("Totalscore: The total score from all your Blobby Blue Sessions.")
print("Totalapplenumber: All apples you've eaten in all sessions.")
print("TotalTNTnumber: All TNT you've eaten in your sessions.")
parameter.number("functionTime",0.5,7,4)
saveTreeEncounters = 0
score = 0
saveScore = 0
musicTime = 324
treeTrue = false
totalScore = readLocalData("totalScore",0)
highScore = readLocalData("highScore", 0)
totalAppleNumber = readLocalData("totalAppleNumber",0)
totalTNTNumber = readLocalData("totalTNTNumber",0)
totalTreeEncounters = readLocalData("totalTreeEncounters",0)
callAmount = functionTime
parameter.watch("score")
parameter.action("Save",save)
parameter.watch("totalScore")
parameter.watch("totalAppleNumber")
parameter.watch("totalTNTNumber")
parameter.watch("totalTreeEncounters")
appleX = math.random(50,WIDTH - 50)
appleY = math.random(50,HEIGHT - 50)
rareappleX = math.random(50,WIDTH - 50)
rareappleY = math.random(50,HEIGHT - 50)
tntX = math.random(50,WIDTH - 50)
tntY = math.random(50,HEIGHT - 50)
treeX = math.random(50,WIDTH - 50)
treeY = math.random(50,HEIGHT - 50)
end
function zero()
musicTime = musicTime + 324
music("Game Music One:Zero")
end
function draw()
background(25, 28, 29, 255)
sprite("Dropbox:Blobby_Blue",CurrentTouch.x,CurrentTouch.y)
if appleGone == false then
sprite(apple,appleX,appleY)
eat()
end
if treeTrue == true then
sprite(tree,treeX,treeY)
chop()
end
if ElapsedTime > callAmount then
spawn()
end
if ElapsedTime > musicTime then
zero()
end
if tntSpawn == 1 then
sprite(tnt,tntX,tntY)
boom()
end
if appleSpawn == 1 then
sprite(rareApple,rareappleX,rareappleY)
eat()
end
end
function spawn()
appleGone = false
appleX = math.random(50,WIDTH - 50)
appleY = math.random(0,HEIGHT - 50)
callAmount = callAmount + functionTime
tntSpawn = math.random(1,5)
if treeTrue == true then
appleSpawn = 1
rareappleX = math.random(50,WIDTH - 50)
rareappleY = math.random(50,HEIGHT - 50)
else
appleSpawn = math.random(1,8)
if appleSpawn == 1 then
rareappleX = math.random(50,WIDTH - 50)
rareappleY = math.random(50,HEIGHT - 50)
end
end
if tntSpawn == 1 then
tntX = math.random(50,WIDTH - 50)
tntY = math.random(50,HEIGHT - 50)
end
if treeTrue == false then
treeRoll = math.random(1,25)
treeX = math.random(50,WIDTH - 50)
treeY = math.random(50,HEIGHT - 50)
if treeRoll == 1 then
treeTrue = true
print("A tree has spawned!")
saveTreeEncounters = saveTreeEncounters + 1
end
end
end
function save()
if score > highScore then
highScore = score
saveLocalData("highScore",highScore)
print("Sucess! Your new High score is: "..highScore.."!")
else
print("You didn't beat your High Score yet! It is "..highScore..".")
end
if saveScore > 0 then
totalScore = totalScore + saveScore
saveScore = 0
saveLocalData("totalScore",totalScore)
end
totalAppleNumber = totalAppleNumber + saveAppleNumber
saveAppleNumber = 0
saveLocalData("totalAppleNumber",totalAppleNumber)
totalTreeEncounters = totalTreeEncounters + saveTreeEncounters
saveTreeEncounters = 0
saveLocalData("totalTreeEncounters",totalTreeEncounters)
totalTNTNumber = totalTNTNumber + saveTNTNumber
saveTNTNumber = 0
saveLocalData("totalTNTNumber",totalTNTNumber)
end
--# Eat
function eat ()
local w,h = apple.width * 2,apple.height * 2
local top = appleY + h
local bottom = appleY - h
local left = appleX - w
local right = appleX + w
local x,y = CurrentTouch.x,CurrentTouch.y
if x >= left and x <= right and y >= bottom and y <= top and appleGone == false then
appleNumber = appleNumber + 1
saveAppleNumber = saveAppleNumber + 1
appleGone = true
score = score + 4/functionTime
saveScore = saveScore + 4/functionTime
sound("A Hero's Quest:Eat 3")
if appleNumber == 1 then
print("You now ate "..appleNumber.." apple!")
else
print("You now ate "..appleNumber.." apples!")
end
end
local w3,h3 = rareApple.width * 2,rareApple.height * 2
local top = rareappleY + h3
local bottom = rareappleY - h3
local left = rareappleX - w3
local right = rareappleX + w3
local x3,y3 = CurrentTouch.x,CurrentTouch.y
if x3 >= left and x3 <= right and y3 >= bottom and y3 <= top and appleSpawn == 1 then
appleNumber = appleNumber + 1
saveAppleNumber = saveAppleNumber + 1
appleSpawn = 2
score = score + 40/functionTime
saveScore = saveScore + 40/functionTime
sound("A Hero's Quest:Eat 3")
if appleNumber == 1 then
print("You now ate "..appleNumber.." apple!")
else
print("You now ate "..appleNumber.." apples!")
end
end
end
function boom ()
local w2,h2 = tnt.width * 2,tnt.height * 2
local top = tntY + h2
local bottom = tntY - h2
local left = tntX - w2
local right = tntX + w2
local x2,y2 = CurrentTouch.x,CurrentTouch.y
if x2 >= left and x2 <= right and y2 >= bottom and y2 <= top and tntSpawn == 1 then
tntNumber = tntNumber + 1
saveTNTNumber = saveTNTNumber + 1
print("BOOM! You tried to eat "..tntNumber.." TNT.")
tntSpawn = 2
score = score - 10
saveScore = saveScore - 10
sound(DATA, "ZgNAHxo7RkBAQ1VA6HatPTzT3z6BfBE/UQBAZlk+IEBAQCBr")
end
end
function chop()
local w4,h4 = tree.width,tree.height
local top = treeY + h4
local bottom = treeY - h4
local left = treeX - w4
local right = treeX + w4
local x4,y4 = CurrentTouch.x,CurrentTouch.y
if x4 >= left and x4 <= right and y4 >= bottom and y4 <= top and treeTrue == true then
print("Tree Destroyed.")
sound(DATA, "ZgNAWBY/QBkDXFJ5D7OAPWMPszwLyBc/KgASfz9ANEo6XnFX")
treeTrue = false
end
end