-------------------------------
--- Generated by RyderLua------
--- Made By Ash99--------------
--- 1/5/2024 10;31 am friday---
-------------------------------

-- Require the Love2D game framework
local love = require('love')

-- Define variables for the button position, size, and rainbow colors
local buttonX = 100
local buttonY = 100
local buttonWidth = 200
local buttonHeight = 50
local rainbowColors = {
    {255, 0, 0}, -- Red
    {255, 165, 0}, -- Orange
    {255, 255, 0}, -- Yellow
    {0, 255, 0}, -- Green
    {0, 127, 255}, -- Blue
    {139, 0, 255} -- Purple
}

-- Variable to keep track of the current color index
local currentColorIndex = 1

-- Function to update the game state
function love.update(dt)
    -- Check if the mouse is over the button and change color when clicked
    local mouseX, mouseY = love.mouse.getPosition()
    if mouseX >= buttonX and mouseX <= (buttonX + buttonWidth) and mouseY >= buttonY and mouseY <= (buttonY + buttonHeight) then
        if love.mouse.isDown(1) then
            currentColorIndex = currentColorIndex % #rainbowColors + 1
        end
    end
end

-- Function to draw the game to the screen
function love.draw()
    -- Draw the button with the current rainbow color
    love.graphics.setColor(rainbowColors[currentColorIndex])
    love.graphics.rectangle("fill", buttonX, buttonY, buttonWidth, buttonHeight)

    -- Draw text on the button
    love.graphics.setColor(0, 0, 0)
    love.graphics.print("Click me!", buttonX + 60, buttonY + 15)
end
