This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
andrei23's profile picture

terminal glasses

Started by andrei23, 24 March 2014 - 03:43 PM
andrei23 #1
Posted 24 March 2014 - 04:43 PM
Ok so I have this code: http://pastebin.com/00rKNwWc

I dont have any idea how to make the animation go smoother unless I reduce the sleep time to 0.00001 which is obviously bugging the glasses.

Maybe you can help me , guys?

The animation method:

  • m = peripheral.wrap("top") – which is the terminal glasses bridge
  • modem = peripheral.wrap("left") – which is the modem
  • width = 150
  • height = 50
  • function animation()
  • for i = 1,50 do
  • m.clear()
  • m.addBox(10, 10, width, height, 0xFFFFFF, 0.5)
  • width = width - 3
  • height = height - 1
  • sleep(0.1)
  • end
  • for i = 1,50 do
  • m.clear()
  • m.addBox(10, 10, width, height, 0xFFFFFF, 0.5)
  • width = width + 3
  • height = height + 1
  • sleep(0.1)
  • end
  • end
Lyqyd #2
Posted 24 March 2014 - 06:14 PM
Don't clear the glasses. If you can set new coordinates for the box, do that. Otherwise, it's just going to flicker. You also can't get reliable sleeps much shorter than 0.05s in practical terms, IIRC.