Tip For my incremental game
the current issue I'm having is only 1 button will show up when I have the correct code for 2 buttons
the current issue I'm having is only 1 button will show up when I have the correct code for 2 buttons
Have you used a list? or an identifier for your button
Try using (name of your list) + push(new...(name of the button...). For example: hello = [] hello.push(hi = object = x = 0 y = 0 end)
its telling me that "checkRectMouseHover = function() is not a function even tho I declared it a function in a different file
BaseBoost = 0
MultiBoost = 1
ExpondentalBoost = 1
Point_Gain = (((1 + BaseBoost) * MultiBoost) ^ ExpondentalBoost)
//Upgrade button
buttons = []
buttons.push(
button = object
x = 175
y = 75
width = 45
height = 45
text = "Points Upgrades"
action = function() print("success") end
scale = 1
alpha = 4
end
)
for button in buttons
//check hover
button.scale = 1
if checkRectMouseHover(button.x, button.y, button.width, button.height) then
button.alpha = 1
if mouse.press then
button.action()
end
if mouse.pressed then
button.scale = 1.1
end
else
button.alpha = 0.7
end
end
draw = function()
// set up the game
screen.clear()
screen.fillRect(0, 0, 400, 400, "rgb(142,217,255")
screen.setFont("RetroGaming")
// draw the Points
screen.drawText("Points: " + Points, -125,85,15 "rgb(0,0,0)")
for button in buttons
screen.setDrawScale(button.scale, button.scale)
screen.setAlpha(button.alpha)
screen.fillRoundRect(button.x-100, button.y-10,
button.width+50, button.height+50,"rgb(255,255,255)")
screen.drawSprite("point_upgrades", 175, 75, 45, 45)
screen.drawText(button.text, button.x-100, button.y-10)
screen.setDrawScale(1, 1)
screen.setAlpha(1)
end```
Bring me an invitation so I can help you
ok I'll coming
Okay, I see the problem. First, you have init and you're not using classes. If you don't mind, I can fix all that while keeping your ideology.
Give me your main values... I'm going to calculate a remuneration, let's go. You can assist me if you want.
ok we got Points, Points_Gain, SavedData, hover, BaseBoost, MultiBoost, ExpondentalBoost, frameCount, draw function, buttons list, init function, save game function, update function, and chechRectMouseHover function
Okay, I've started from scratch. Come take a look and add what's missing. Sorry, I didn't understand anything.
Sorry, everything is perfect now, try it and you'll see.