-- scripts/box.lua -- Autonomous bouncing box. -- Edit vx, vy, or the color below, save the file, and watch it update live! local vx, vy = 2050, 110 -- ← try cranking these up local size = 60 local r, g, b = 255, 180, 50 -- ← golden amber box function on_init() log("Box ready – bouncing at vx=" .. vx .. " vy=" .. vy) end function on_update(dt) self_x = self_x + vx * dt self_y = self_y + vy * dt -- Bounce off the four walls (respecting the editor panel) if self_x < 0 or self_x + size > 1055 then vx = -vx self_x = math.max(0, math.min(1055 - size, self_x)) end if self_y < 0 or self_y + size > 720 then vy = -vy self_y = math.max(0, math.min(720 - size, self_y)) end end function on_render() draw_rect(self_x, self_y, size, size, r, g, b) -- Velocity debug overlay local speed_label = "v=" .. math.floor(math.sqrt(vx * vx + vy * vy)) draw_text(speed_label, self_x + 4, self_y + size / 2 - 6, 12, 0, 0, 0) end