1214 posts
Location
The Sammich Kingdom
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?
671 posts
Location
That place over there. Y'know. The one where I am.
Posted 04 November 2012 - 10:23 PM
You could just clear that line with term.clearLine()
514 posts
Location
Over there
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.
818 posts
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
1214 posts
Location
The Sammich Kingdom
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.
514 posts
Location
Over there
Posted 05 November 2012 - 01:33 AM
Clearing single chars by printing " " might work.
818 posts
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
514 posts
Location
Over there
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.