Creating Realtime delays ...
BlitzPlus Forums/BlitzPlus Programming/Creating Realtime delays ...
| ||
@all Now, I finally figured out how to use loadanimimage() and displayimage(), but what is the best method to "delay" an animation sequence? blitz is so fast my animation is FAST ... too fast! need to slow it down by some kind of counter! |
| ||
Use Millisecs() and a counter variable perhaps. |
| ||
There is also WaitTimer(), but MilliSecs() is probably the command you are looking for. |
| ||
Example:MyImg = LoadAnimImage("pic.png", 16, 16, 0, 5) Local imgF% = 0, Time% = MilliSecs() Repeat DrawImage MyImg, 0, 0, imgF If MilliSecs() >= Time + 100 then If imgF < 4 then imgF = imgF + 1 else imgF = 0 Time# = MilliSecs() endif Until KeyDown(1)*edit* @Wolron: Oops, all better. |
| ||
Time# = MilliSecs() Pointless to assign MilliSecs() to a float since it returns an integer. |
| ||
so everyone uses Milisecs() ?? no-one uses any kind of VBLANK ?? |
| ||
VBlank... that was on the Amiga wasn't it? No, VBlank would be the same as VWait in Blitz (i.e. wait for next vertical blank event on the monitor) but because monitors have various refresh rates 60Hz,85Hz etc you won't have precise control of timing on machines that have different refresh rates. The Amiga wasn't affected in this way as its refresh rates were all the same. MilliSecs() would be your best bet as suggested above. |
| ||
You cannot change the background color of each line on a PC like you could on an Amiga. With a PC you have to draw everything. There isn't any raster/copper list to do this for you. |