forums

TNT Basic Forums > Programming Q&A
Flashing Animation
< Last Thread     Next Thread >
Author
Thread        Post A Reply

05-01-2009 15:24

Posted by:
rwulfy

Click Here to Email rwulfy   Find more posts by rwulfy

Hey Everybody, I have a question, not sure if this is basic or not.

I have an animation running inside a for loop, and i have set it to have a boundary at y=600.

the full code is shown below

float x[500]
float y[500]
int rep=1
float count=1
float col[500]
float time
float c[500]


graphics mode 1000,700
repeat
time=time+1
if time>10
time=0
x[count]=random(0,500)
c[count]=random(5,10)
col[count]=random(0,9999999)
count=count+1
end if
for rep=0 to count

set pen color col[rep]
fill oval x[rep],y[rep] to x[rep]+c[rep],y[rep]+c[rep]
draw frame
set pen colour black
fill oval x[rep],y[rep] to x[rep]+c[rep],y[rep]+c[rep]
y[rep]=y[rep]+10
if y[rep]=600
y[rep]=0
end if
next rep


forever

There are 2 main issues. one is that the shape flashes while it moves down the screen, and the other is that, after a small amount of time, the whole thing begins to lag terribly.

if anyone has any idea as to how to correct or improve this, let me know

05-01-2009 21:32

Posted by:
swagIT

Location:
Great Wet North (Vancouver)

Find more posts by swagIT

I think you would be better off using a sprite and then moving the sprite instead of all the drawing commands.


You just need a bunch of different coloured circles.

I think the flickering is the slight delay going from colour to black back to colour.



cheers

barry

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.