forums

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

09-20-2006 23:57

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Hi everyone,

I'm working on a project, and i want to have an animation that changes every 4th of a second, and also randoms its position every 4 seconds. Can't figure it out, can anyone help me on this?

Thanks,
Stephen

09-21-2006 01:09

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

> randoms its position every 4 seconds

i'm not exactly sure what you. do you mean that each 4 frames, the sprite should jump around randomly and change picture?

maybif i understand correctly, maybe something like:

int tick=0
int image=0
int x=0,y=0

while true

tick=tick+1

if tick=4
tick=0
image=image+1
x=random(0,640)
y=random(0,480)
end if

sprite 1,x,y,image
wend

09-21-2006 01:10

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

oh wait you meant seconds and not ticks... well maybe just arrange ticks to fit appoximately the correct time at a certain FPS, or, if you use variable FPS, you would need a way to get the current FPS (is there such command in TNT?)

09-21-2006 16:27

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Maybe I did not explain it very well.

I need to have a red light flashing and have it move randomly every four seconds.

09-21-2006 16:36

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Never Mind, i was able to find it out,

Thanks anyway,
Stephen

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.