Hey again, I’ve continued working on my time management game and came up with this: a Codea developer simulator. You start as a noob and work yourself to the top! I’m still working out the details but I’m already excited to share my code with you all, so here it is:
--# Main
-- Codea Dev Simulator
displayMode(FULLSCREEN)
-- Use this function to perform your initial setup
function setup()
Codea = false
Subscription = false
Blog = false
gameMode = Menu
cash = 25
knowledge = 0
ranks={"Codea Noob", "Average Programmer", "Codea Veteran", "Supercomputer", "Simeon Himself"}
rank=ranks[1]
C1=Clicker(vec2(300, HEIGHT-300), "Edit example projects", 0, 0.05, 3)
C2=Clicker(vec2(300, HEIGHT-400), "Ask a question on the forums", 0, 0.1, 1.5)
C3=Clicker(vec2(300, HEIGHT-500), "Make a 2D game", 0, 0.3, 1)
C4=Clicker(vec2(300, HEIGHT-600), "Sell your game's code", 8, 0.7, 0.3)
C5=Clicker(vec2(WIDTH-300, HEIGHT-300), "Publish a 2D game", 16, 1.2, 0.2)
C6=Clicker(vec2(WIDTH-300, HEIGHT-400), "Publish a 3D game", 28, 2.1, 0.1)
C7=Clicker(vec2(WIDTH-300, HEIGHT-500), "Post a blog update", 0, 0.5, 4)
C8=Clicker(vec2(WIDTH-300, HEIGHT-600), "Make a Codea tutorial", 0, 2, 0.7)
end
-- This function gets called once every frame
function draw()
if knowledge > 100 then
knowledge = 100
end
--Ranking
if knowledge>99 then
rank=ranks[5]
elseif knowledge>75 then
rank=ranks[4]
elseif knowledge>50 then
rank=ranks[3]
elseif knowledge>25 then
rank=ranks[2]
end
-- This sets a dark background color
background(40, 40, 50)
gameMode()
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
end
function Menu()
background(255, 255, 255, 255)
sprite("Cargo Bot:Codea Logo", WIDTH/2-250, HEIGHT-150)
fontSize(100)
font("AmericanTypewriter-Light")
fill(0, 0, 0, 255)
text("Developer", WIDTH/2+250, HEIGHT-170)
fill(0, 47, 255, 255)
text("Simulator", WIDTH/2, HEIGHT/2+50)
fill(0, 0, 0, 255)
rect(WIDTH/2-200, 100, 400, 150)
fill(255, 255, 255, 255)
text("Start", WIDTH/2, 175)
end
function Play()
background(255, 255, 255, 255)
fill(0, 0, 0, 255)
rect(WIDTH-100, HEIGHT-200, 100, 50)
fontSize(20)
font("AmericanTypewriter")
text("Rank:"..rank, 150, HEIGHT-50)
text("Knowledge:"..math.floor(knowledge).."%", WIDTH/2, HEIGHT-50)
text("Budget: $"..cash, WIDTH-150, HEIGHT-50)
fill(255, 255, 255, 255)
text("Store", WIDTH-50, HEIGHT-175)
if Codea == true then
C1:draw()
C2:draw()
C3:draw()
C4:draw()
if Subscription==true then
C5:draw()
C6:draw()
end
if Blog==true then
C7:draw()
C8:draw()
end
else
fill(0, 0, 0, 255)
fontSize(50)
text("Go to the store and buy Codea!", WIDTH/2, HEIGHT/2)
text("^", WIDTH-50, HEIGHT-250)
stroke(0, 0, 0, 255)
line(WIDTH-50, HEIGHT-255, WIDTH-50, 450)
stroke(0, 0, 0, 0)
end
end
function Store()
background(255, 255, 255, 255)
fill(0, 0, 0, 255)
rect(WIDTH-100, HEIGHT-100, 100, 100)
--Buy Codea
if Codea == false then
fill(0, 0, 0, 255)
rect(WIDTH/2-150, HEIGHT/2+200, 300, 50)
fontSize(15)
textWrapWidth(300)
text("Start your adventure buy purchasing this wonderful app from Two Lives Left!", WIDTH/2, HEIGHT/2+175)
textWrapWidth(WIDTH)
fill(255, 255, 255, 255)
fontSize(20)
text("Buy Codea -$10-", WIDTH/2, HEIGHT/2+225)
else
fill(50, 167, 23, 255)
rect(WIDTH/2-150, HEIGHT/2+200, 300, 50)
fill(255, 255, 255, 255)
text("Purchased", WIDTH/2, HEIGHT/2+225)
end
--Buy iTunes dev account
if Subscription == false then
fill(0, 0, 0, 255)
rect(WIDTH/2-150, HEIGHT/2+100, 300, 50)
fontSize(15)
textWrapWidth(300)
text("Want to publish your apps? Buy this for only $100!", WIDTH/2, HEIGHT/2+75)
textWrapWidth(WIDTH)
fontSize(20)
fill(255, 255, 255, 255)
text("Buy dev subscription -$100-", WIDTH/2, HEIGHT/2+125)
else
fill(50, 167, 23, 255)
rect(WIDTH/2-150, HEIGHT/2+100, 300, 50)
fill(255, 255, 255, 255)
text("Purchased", WIDTH/2, HEIGHT/2+125)
end
--Buy blog
if Blog == false then
fill(0, 0, 0, 255)
rect(WIDTH/2-150, HEIGHT/2, 300, 50)
fontSize(15)
textWrapWidth(300)
text("Keep your fans updated about your games and double your profits :D", WIDTH/2, HEIGHT/2-25)
textWrapWidth(WIDTH)
fontSize(20)
fill(255, 255, 255, 255)
text("Buy a blog -$200-", WIDTH/2, HEIGHT/2+25)
else
fill(50, 167, 23, 255)
rect(WIDTH/2-150, HEIGHT/2, 300, 50)
fill(255, 255, 255, 255)
text("Purchased", WIDTH/2, HEIGHT/2+25)
end
fill(255, 255, 255, 255)
fontSize(20)
font("AmericanTypewriter")
text("Back", WIDTH-50, HEIGHT-50)
fill(0, 0, 0, 255)
text("Budget: $"..cash, 150, HEIGHT-50)
end
function touched(t)
--Menu
if gameMode == Menu then
if t.x>WIDTH/2-200 and t.x<WIDTH/2+200 and t.y>100 and t.y<250 and t.state == ENDED then
gameMode = Play
end
end
--Game
if gameMode == Play then
if Codea==true then
C1:touched(t)
C2:touched(t)
C3:touched(t)
C4:touched(t)
if Subscription==true then
C5:touched(t)
C6:touched(t)
end
if Blog==true then
C7:touched(t)
C8:touched(t)
end
end
if t.x > WIDTH-100 and t.y < HEIGHT-150 and t.y > HEIGHT-200 and t.state == ENDED then
gameMode = Store
end
end
--Store
if gameMode == Store then
--Back
if t.x > WIDTH-100 and t.y > HEIGHT-100 and t.state == ENDED then
gameMode = Play
end
--Buy Codea
if Codea == false and cash>=10 and t.x>WIDTH/2-150 and t.x<WIDTH/2+150 and t.y>HEIGHT/2+200 and t.y<HEIGHT/2+250 and t.state==ENDED then
cash=cash-10
Codea=true
sound("Game Sounds One:Assembly 4")
end
--Buy dev subscription
if Subscription == false and cash>=100 and t.x>WIDTH/2-150 and t.x<WIDTH/2+150 and t.y>HEIGHT/2+100 and t.y<HEIGHT/2+150 and t.state==ENDED then
cash=cash-100
Subscription=true
sound("Game Sounds One:Assembly 4")
end
--Buy dev subscription
if Blog == false and cash>=200 and t.x>WIDTH/2-150 and t.x<WIDTH/2+150 and t.y>HEIGHT/2 and t.y<HEIGHT/2+50 and t.state==ENDED then
cash=cash-200
Blog=true
C4.incm = C4.incm*2
C5.incm = C5.incm*2
C6.incm = C6.incm*2
sound("Game Sounds One:Assembly 4")
end
end
end
--# Clicker
Clicker = class()
function Clicker:init(pos, name, incm, exp, speed)
-- you can accept and set parameters here
self.pos = pos
self.name = name
self.incm = incm
self.exp = exp
self.speed = speed
self.earn = false
self.earnw = 0
end
function Clicker:draw()
-- Codea does not automatically call this method
fill(255, 0, 0, 255)
rect(self.pos.x-25, self.pos.y-15, 50, 30)
fill(24, 39, 161, 255)
fontSize(15)
font("ArialMT")
text(self.name, self.pos.x, self.pos.y+25)
fontSize(15)
fill(0, 0, 0, 255)
if self.incm~=0 then
text("Income:"..self.incm, self.pos.x, self.pos.y-30)
end
--Earning process
if self.earn == true then
fill(30, 159, 39, 255)
rect(self.pos.x+50, self.pos.y-15, self.earnw, 30)
if self.earnw<100 then
self.earnw=self.earnw+self.speed
elseif self.earnw>=100 then
cash = cash+self.incm
knowledge = knowledge+self.exp
self.earnw=0
sound("Game Sounds One:Wall Bounce 2")
self.earn = false
end
end
end
function Clicker:touched(t)
-- Codea does not automatically call this method
if self.earnw==0 then
if t.x>self.pos.x-25 and t.x<self.pos.x+25 and t.y>self.pos.y-15 and t.y<self.pos.y+15 and
t.state == ENDED then
self. earn = true
sound("Game Sounds One:Wall Bounce 1")
end
end
end