ayin/games/basic.ayin
2025-12-25 00:44:45 +02:00

41 lines
554 B
Text

let migrate = fn(state) {
state
}
let setup = fn() {
return {
.color: {
.r: 0,
.g: 0,
.b: 100,
},
}
}
let update = fn(state, input) {
let x = if input.gamepad1.dpad.up { 1 } else { 0 } + if input.gamepad1.dpad.down { -1 } else { 0 }
let new_blue = state.color.b + x
state.color.b = min(255, max(0, new_blue))
}
let draw = fn(state) {
frame_clear(state.color.r, state.color.g, state.color.b)
}
let min = fn(a,b) {
if a < b {
a
} else {
b
}
}
let max = fn(a,b) {
if a < b {
b
} else {
a
}
}