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

Animation

Started by Sammich Lord, 04 November 2012 - 07:50 PM
Sammich Lord #1
Posted 04 November 2012 - 08:50 PM
I was wondering what the best way to animate something in real time would be? For instance if I had a few frames like this:

0

 0

  0
And let's say I had other stuff on the screen that I did not want to re-write again. But I do not want to have a rendering engine to actually move the "0" from one spot to another. So what would the best way to do that be?
Shnupbups #2
Posted 04 November 2012 - 10:23 PM
You could just clear that line with term.clearLine()
Leo Verto #3
Posted 05 November 2012 - 01:15 AM
You could code a keyframe system, by moving a line from one "0" to the next one, but it probably wouldn't be that easy.
Doyle3694 #4
Posted 05 November 2012 - 01:21 AM
store everything you want permanent in a table and then for a new frame just clear the screen and print this out and then the actual frame. ofcourse if your permanent stuff is a few lines alone then you cna just clearLine() the other lines
Sammich Lord #5
Posted 05 November 2012 - 01:29 AM
The point of this is to NOT clear the whole screen. The reason is because if you have a game running at 20 FPS(Max tick rate in minecraft) and you redraw the screen every tick there is flickering. The flickering happens in both SMP and SSP.
Leo Verto #6
Posted 05 November 2012 - 01:33 AM
Clearing single chars by printing " " might work.
Doyle3694 #7
Posted 05 November 2012 - 01:36 AM
Leo Verto: Yeah thats a really good idea

And Human: I have not been experiencing this with my little game which redrew the screen 40 times a second
Leo Verto #8
Posted 05 November 2012 - 01:40 AM
It always depends on your hardware, but keeping the lag to a minimum is just profit for all users.