Discord
Login
Community
DARK THEME

Can you guy help me

Hey guy can you help with something because I am making a clicker game but when I put the code in the source, it gave me this Expected opening parentheses, in file "shop" at line 4, column 18 microScript 2.0 Expected opening parentheses, in file "player" at line 7, column 20 Expected opening parenthese, in file "main" at line 6, column 13 Expected opening parenthese, in file "shop" at line 4, column 18 Expected opening parenthese, in file "main" at line 6, column 13 Syntax Error, in file "shop" at line 1, column 11, and I don't know what to do with it. Can someone help me, pls? That will be all.

well we cant help you without the code!

score = 0 scorePerClick = 1 autoCps = 0 autoCpsAccumulator = 0

function init() player_init() shop_init() upgrades_init() end

function update() -- auto-clicker logic autoCpsAccumulator = autoCpsAccumulator + 0.016 * autoCps -- assuming 60FPS if autoCpsAccumulator >= 1 then clicks = math.floor(autoCpsAccumulator) score = score + clicks autoCpsAccumulator = autoCpsAccumulator - clicks end

-- update modules
player_update()
shop_update()
upgrades_update()

end

function draw() screen.clear() screen.drawText(4,4,"Score: "..math.floor(score)) screen.drawText(4,16,"Per Click: "..scorePerClick) screen.drawText(4,28,"Auto CPS: "..autoCps) screen.drawText(4,40,"Press Z / Click to click")

player_draw()
shop_draw()
upgrades_draw()

end

function addScore(n) score = score + n end

function getScore() return score end

function setScore(n) score = n end

function getScorePerClick() return scorePerClick end

function setScorePerClick(n) scorePerClick = n end

function addAutoCps(n) autoCps = autoCps + n end

function getAutoCps() return autoCps end

init()

btnPressed = false iconX = 120 iconY = 80 iconW = 16 iconH = 16

function player_init() btnPressed = false end

function player_update() if input.isDown("z") or input.isDown("space") or input.isDown("mouse_left") then if not btnPressed then btnPressed = true addScore(getScorePerClick()) if sound then sound.play("click") end end else btnPressed = false end end

function player_draw() screen.drawSprite("icon", iconX, iconY, iconW, iconH) end

shopNames = {"Cursor (+1 click)","Auto Clicker (+1 cps)","Auto Clicker (+5 cps)"} shopCosts = {10,50,200}

function shop_init() end

function shop_update() if input.isPressed("1") then buyShop(1) end if input.isPressed("2") then buyShop(2) end if input.isPressed("3") then buyShop(3) end end

function shop_draw() screen.drawText(4,80,"Shop (press 1-3)") for i=1,3 do screen.drawText(4, 80 + i*12, i..") "..shopNames[i].." - "..shopCosts[i]) end end

function buyShop(index) if index == 1 and getScore() >= 10 then setScore(getScore()-10) setScorePerClick(getScorePerClick()+1) if sound then sound.play("coin") end elseif index == 2 and getScore() >= 50 then setScore(getScore()-50) addAutoCps(1) if sound then sound.play("coin") end elseif index == 3 and getScore() >= 200 then setScore(getScore()-200) addAutoCps(5) if sound then sound.play("coin") end else if sound then sound.play("error") end end end

@potoo I have the code you want to see them and the game i making is not working and give me the erro and I don't like the erro

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community