Points = storage.get("point")
BaseUPG1 = storage.get("Base_UPG1")
ValeurClic = storage.get("Point_Gain")
BaseBoost = storage.get("formula_v1")
MultiBoost = storage.get("formula_v2")
MultiUPG1 = storage.get("Multi_UPG1")
MultiUPG1Lvl = storage.get("Multi_UPG1Lvl")
MultiUPG2Lvl = storage.get("MultiUPG2_Lvl")
MultiUPG2 = storage.get("MultiUPG2")
abbreviate = function(Points)
if Points < 1000 then return floor(Points) end
// Standard English abbreviations: k, Million, Billion, Trillion...
local units = ["k", "M", "B", "T", "Qd", "Qi", "Sx", "Sp"]
local index = -1
local value = Points
while value >= 1000 and index < units.length - 1
value /= 1000
index += 1
end
// Example: 1.285M
return (floor(value * 1000) / 1000) + units[index]
end
if Points == undefined then Points = 0 end
if BaseUPG1 == undefined then BaseUPG1 = 10 end
if ValeurClic == undefined then ValeurClic = 1 end
if MultiUPG1 == undefined then MultiUPG1 = 250 end
if MultiUPG1Lvl == undefined then MultiUPG1Lvl = 0 end
if BaseBoost == undefined then BaseBoost = 0 end
if MultiBoost == undefined then MultiBoost = 1 end
if MultiUPG2 == undefined then MultiUPG2 = 10000 end
if MultiUPG2Lvl == undefined then MultiUPG2Lvl = 0 end
msg = ""
msgTimer = 0
Button = class
constructor = function(x, y, width, height, id)
this.x = x
this.y = y
this.width = width
this.height = height
this.id = id
this.oldW = width
this.oldH = height
end
end
buttons = []
buttons.push(new Button(-175, -75, 45, 45, "1"))
buttons.push(new Button(175, 70, 45, 45, "2"))
buttons.push(new Button(150, -75, 100, 40, "3"))
buttons.push(new Button(150, -30, 100, 40, "4"))
buttons.push(new Button(150, 15, 100, 40, "5"))
end
update = function()
if msgTimer > 0 then msgTimer -= 1 end
value = Points
ValeurClic = floor((1 + BaseBoost) * MultiBoost)
for b in buttons
local targetW = b.width
local targetH = b.height
if checkRectMouseHover(b.x, b.y, b.width, b.height) then
targetW = b.width + 15
targetH = b.height + 15
if b.id == "2" and mouse.press then
Points += ValeurClic
end
if b.id == "1" and mouse.press then
storage.set("point", Points)
storage.set("Base_UPG1", BaseUPG1)
storage.set("Point_Gain", ValeurClic)
storage.set("Multi_UPG1", MultiUPG1)
storage.set("Multi_UPG1Lvl", MultiUPG1Lvl)
storage.set("formula_v1", BaseBoost)
storage.set("formula_v2", MultiBoost)
storage.set("MultiUPG2_Lvl", MultiUPG2Lvl)
storage.set("Multi_UPG2", MultiUPG2)
msg = "GAME SAVED!"
msgTimer = 120
end
if b.id == "3" and mouse.press then
if Points >= BaseUPG1 then
Points -= BaseUPG1
BaseBoost += 1
BaseUPG1 = floor(BaseUPG1 * 1.25)
msg = "UPGRADE BOUGHT!"
msgTimer = 120
end
end
if b.id == "4" and mouse.press then
if Points >= MultiUPG1 and MultiUPG1Lvl < 50 then
Points -= MultiUPG1
MultiUPG1Lvl += 1
MultiBoost = (MultiBoost * 1.5)
MultiUPG1 = floor(MultiUPG1 * 2)
end
end
if b.id == "5" and mouse.press then
if Points >= MultiUPG2 and MultiUPG2Lvl < 10 then
Points -= MultiUPG2
MultiUPG2Lvl += 1
MultiUPG2 = (MultiUPG2 * 10)
MultiBoost = (MultiBoost * 2)
end
end
end
if b.oldW < targetW then b.oldW += 1
elsif b.oldW > targetW then b.oldW -= 1
end
if b.oldH < targetH then b.oldH += 1
elsif b.oldH > targetH then b.oldH -= 1
end
end
end
draw = function()
screen.clear("rgb(85,198,255)")
screen.drawText("POINTS: " + Points, -150, 75, 20, "Black")
if msgTimer > 0 then
screen.drawText(msg, 0, 120, 15, "rgb(255,255,255)")
end
for b in buttons
if b.id == "2" then
screen.drawSprite("point_upgrades", b.x, b.y, b.oldW, b.oldH)
elsif b.id == "1" then
screen.drawSprite("save", b.x, b.y, b.oldW, b.oldH)
elsif b.id == "3" then
screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
screen.drawText("+1 BaseGain: " + BaseUPG1, b.x, b.y, 12, "white")
elsif b.id == "4" and BaseUPG1 >= 78 and MultiUPG1Lvl < 50 then
screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
screen.drawText("1.5x Multiplier: " + MultiUPG1, b.x, b.y, 12, "white")
elsif b.id == "5" and MultiUPG1 >= 1000 and MultiUPG2Lvl < 10 then
screen.fillRect(b.x, b.y, b.oldW, b.oldH, "orange")
screen.drawRect(b.x, b.y, b.oldW, b.oldH, "white")
screen.drawText("2x Multiplier:" + MultiUPG2, b.x, b.y, 12, "white")
end
end
end```