Watch

Uses the PICO-8 math and T libraries.

pico8-demo-2.gif
#include ./math.lua
#include ./t.lua

h0 = vec2(0,-1)
h1 = vec2(0,-1)
h2 = vec2(0,-1)

function _init()
  t_every(1/60, tick, h0)
  t_every(1, tick, h1)
  t_every(60, tick, h2)
end

function tick(hand)
  hand:rot(d2r(-360/60))
end

function _update60()
  t_step()
end

function _draw()
  cls()

  circfill(64,64,48,0)

  print_time()

  circ(32,64,12,6)
  draw_hand(h0,32,64,10,5)

  circ(64,64,48,6)
  draw_hand(h1,64,64,44,7)
  draw_hand(h2,64,64,32,9)
end

function print_time()
  local str = flr(t()) % 60
  print(str, 63,100, 6)
end

function draw_hand(h, cx, cy, length, col)
  local tip = h:clone():mul(length):add(cx,cy)
  line(cx,cy, tip.x,tip.y, col)
end

Date: 2024-04-08 Mon 07:57

Author: Alexandre Rousseau

Created: 2024-05-27 Mon 22:28

Validate