# All holding, charging, gravity, jumping, and floor behavior is authored here. state holding = 0 state charge = 0 state y = 240 state velocity = 0 input jump = Space box floor(40, 261, 560, 4, "#356548") circle actor(180, y, 20, "#c78638") box meter(80, 80, charge * 200, 12, "#c78638") text amount(80, 60, charge, "Charge: ") on jump.down { if y >= 240 { holding = 1 charge = 0 } } on jump.up { if holding { velocity = -(160 + charge * 300) holding = 0 charge = 0 } } on frame { if holding { charge = clamp(charge + dt, 0, 1) } velocity = velocity + 600 * dt y = y + velocity * dt if y >= 240 { y = 240 velocity = 0 } }