I need to make a box that stays red after my mouse enters the box. I have the code that works, but once my mouse leaves the box, it returns to white. Help? I edited my code to show you guys more. Sorry, this is my first time using this site so I am kind of a noob.
override func update() {
// ****** IMPORTANT - PLEASE NOTE ******
// Variables declared here, inside the update function,
// only remember values for one call (execution) to the update function.
// When update is called again to redraw the view, a variable
// declared inside the function will not remember its previous value.
background(gray: 0.5)
// *************************************************
// Insert your drawing code here, below this comment
rect(x: 200, y: 175, width: 75, height: 75)
rect(x: 305, y: 175, width: 75, height: 75)
rect(x: 410, y: 175, width: 75, height: 75)
rect(x: 515, y: 175, width: 75, height: 75)
var boxA = false
if tin.mouseX >= 200.0 && tin.mouseX <= 275.0 && tin.mouseY >= 175.0 && tin.mouseY <= 250.0 {
boxA = true
}
if boxA == true {
fillColor(red: 1, green: 0, blue: 0, alpha: 1)
rect(x: 200, y: 175, width: 75, height: 75)
}