Posted Tue Aug 9, 2005 1:51 PM
Posted Tue Aug 9, 2005 2:15 PM
We are going to be able to do some cool stuff with batari Basic because the result is fast! I tried using a bunch of for-next loops in a row to try to slow the test program down, but it's still lightning fast. How do you slow the game down for testing? Say you want to have the program wait for one or two seconds after pressing down on the joystick, how would you do that?
Thanks.
Posted Tue Aug 9, 2005 2:51 PM
Oh duh. Now I get it! Thanks.Try something like this . . .
Edited by Random Terrain, Tue Aug 9, 2005 2:52 PM.
Posted Tue Aug 9, 2005 7:34 PM
We are going to be able to do some cool stuff with batari Basic because the result is fast! I tried using a bunch of for-next loops in a row to try to slow the test program down, but it's still lightning fast. How do you slow the game down for testing? Say you want to have the program wait for one or two seconds after pressing down on the joystick, how would you do that?
Thanks.
I use delay counters, but not how you would think. The for-next loops you inserted really just consume inbetween frame time. Since your game still runs, you didn't consume enough to break anything. Remember the difference between this basic and an old 8bit basic is that the program runs every 60th of a second. If you take longer than that, in your gamecode, you won't get enough frames to display a stable picture.
One good way to see everything happen slowly is to use what I call a skip counter. The program has to loop 60 times per second, but it does not have to do everything each time. That's the key to getting a nice slowdown. You set a counter and decrement it once each frame. When it hits zero, you do everything, if it's not zero then you jump over all your game code. That way, the picture still gets drawn every 60th of a second, but your game only runs on specific frames. The end result is a slower game with a stable picture.
Try something like this:
(Set the delay where you set other things at the start of your game)
delay = 10
gameloop
(This is where you set your player positions, etc...)
drawscreen
(Your game code lies after the drawscreen for the most part)
delay = delay - 1
if delay <> 0 then goto skipaction
if delay = 0 then delay = 10
(your game code goes here and only gets executed every 10 frames)
(nice and slow, try smaller numbers for faster, bigger ones for slower)
skipaction
goto gameloop
Posted Tue Aug 9, 2005 7:40 PM
After all, if you're going to be skipping VBIs anyway just so your game doesn't run too fast, then you might as well split up your tasks so you don't have to worry about exceeding the length of a single VBI!
0 members, 0 guests, 0 anonymous users