forums

TNT Basic Forums > Programming Q&A
sprite animation problem
< Last Thread     Next Thread >
Author
Thread        Post A Reply

12-06-2003 18:03

Posted by:
jackbusker

Location:
massachusetts

Find more posts by jackbusker

i have come across a problem i cannot solve. the following code should animate the sprite...


graphics mode 800,600
load images 128
int image=000,running=true,speed=0.2
set framerate 30
while running=true

sprite 1,400,300,image

image = wrap (image+speed,0,3)

draw frame
wend


...but the sprite image does not change at all. however, it does animate as long as the variable speed is 1 or larger, or -1 and smaller. so why doesn't speed=0.2 work? am i missing something?

12-06-2003 19:08

Posted by:
MapMaker

Location:
Edmonton, Alberta (Canada)

Click Here to Email MapMaker   Find more posts by MapMaker

:)

Yes, you are missing something.
0.2 is a decimal number.
The "int" synatx only defines whole numbers.
You want a floating point number, so you would put "float" instead of "int" for the variable "speed".

Hope this helps,
MapMaker

12-06-2003 21:22

Posted by:
jackbusker

Location:
massachusetts

Find more posts by jackbusker

well now i feel stupid...

haha, thanks, i completetly forgot float existed...

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.