Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 1675
Number of posts: 4764

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Game Delays Posted by citpes on 9 Dec 2001 at 11:46 AM
Wazzup people? I'm making a game in QBasic. I have only 1 problem though, The enemy delay. Unfortunatly the way I make the delay the enemys move at different speeds depending on the computer. There has to be a way to make the delay the same for all computers? Please help. this is how I so it now:

delay = delay + 1
IF delay = 5000 THEN
move the enemy
delay = 1
END IF

HELP HELP HELP!!

Report
Re: Game Delays Posted by KDivad Leahcim on 9 Dec 2001 at 11:51 PM
: Wazzup people? I'm making a game in QBasic. I have only 1 problem though, The enemy delay. Unfortunatly the way I make the delay the enemys move at different speeds depending on the computer. There has to be a way to make the delay the same for all computers? Please help. this is how I so it now:
:
: delay = delay + 1
: IF delay = 5000 THEN
: move the enemy
: delay = 1
: END IF
:
: HELP HELP HELP!!
:
:

I've never tried it, but you I suppose could use On Timer to trigger move events somehow...

Another option that many apps I've seen use is to just let the user set the delay...
Report
Re: Game Delays Posted by citpes on 10 Dec 2001 at 10:16 AM
I briefly let the user give the delays but it sucks. The user can make the enemys move slow and complete the game in an hour. I've tried using the TIMER but then the users movements are delayed.
Report
Re: Game Delays Posted by KDivad Leahcim on 10 Dec 2001 at 10:33 AM
: I briefly let the user give the delays but it sucks. The user can make the enemys move slow and complete the game in an hour. I've tried using the TIMER but then the users movements are delayed.
:

Nah, use a loop for the user movements and On Timer for frame rate and enemy updates:

On Timer Goto LabelName
Do
'User movements. InKey, etc.
Loop

LabelName
'Frame update and enemy movements
'Resume back into the loop to continue monitoring for user input.
Report
Re: Game Delays Posted by citpes on 10 Dec 2001 at 10:37 AM
I've tried that but the problem is I can't use fractions of a second.
Report
Re: Game Delays Posted by KDivad Leahcim on 10 Dec 2001 at 10:39 AM
: I've tried that but the problem is I can't use fractions of a second.
:

How about a normal loop and check the time using Timer? It's been a while since I used QB (can you tell? <grin>) and I don't have a copy installed to check, but I think you can check the time (including fractions of a second) with Timer.
Report
Re: Game Delays Posted by mercman2000 on 10 Dec 2001 at 1:54 PM
: delay = delay + 1
: IF delay = 5000 THEN
: move the enemy
: delay = 1
: END IF

You have a good idea going here, and you are correct in thinking it'll be faster. That's why old games run really fast on modern computers; they did for loops and counted instead of syncronising the event with the timer.

start! = TIMER: DO WHILE TIMER < start! + 1: LOOP

What does this do?

First, it assigns start = timer. In my case, timer is now 49907.82. Then, it will stay in the loop until timer is >= to 49908.82, even though it says less than. Put in code, the effect is that it will wait 1 second, indicated by the 1 before the :loop statement. To wait 2 seconds, you'd put a 2 in there, to wait an entire minute, you'd put 60 in there. To wait half a second, you'd put .5 there. See? Hope it helps. Let me know how it goes, ok? Oh, and don't forget the ! after start. Because the timer can go above 32k, it's best to put it in single precision, it holds any timer value, as well as not sucking up too much memory.
---------------------------------------------
I've got a plan, but I'm going to need a dead monkey, some empty liquor bottles, and a vacuum cleaner.

Report
Re: Game Delays Posted by PrzemekG_ on 11 Dec 2001 at 5:08 AM
Using timer
start!=timer
do while timer>=strat!+1:loop

It's work fine until it's 24:00, the the timer reset, so to end the loop you will have to wait 24 hours.

use:
for i = 0 to TimeToWait
  start!=timer
  do while int(start!) <> int(timer)
  loop
next

Ther is a maximum error of 0.8 second in the first second, all the other(2 to ...) will go fine.
if you want a smaller delay than 1 sec :
for i = 0 to TimerToWait
  start!=timer
  do while int(start!*10!) <> int(timer * 10!)
  loop
next

the delay can be each .1 second

Report
Thanx all Posted by citpes on 11 Dec 2001 at 11:15 AM
Thanks for all you help ppl. I've finally got it to work. Thanks again!!
Report
AHHH, the horror!! Posted by citpes on 12 Dec 2001 at 12:55 PM
Sorry to bug you guys again, but, I got a small problem again. In the game that I'm writing I edit the autoexec.bat file to delete some tempary files in the games directory. I've used the following syntax in the autoexec.bat:

del c:\gamedirectory\temp\*.*

The problem is that it asks for confirmation. ie: press y/n
I know there is a way around this, I've seen it somewhere before.

Report
Re: AHHH, the horror!! Posted by mercman2000 on 12 Dec 2001 at 1:21 PM
: Sorry to bug you guys again, but, I got a small problem again. In the game that I'm writing I edit the autoexec.bat file to delete some tempary files in the games directory. I've used the following syntax in the autoexec.bat:
:
: del c:\gamedirectory\temp\*.*
:
: The problem is that it asks for confirmation. ie: press y/n
: I know there is a way around this, I've seen it somewhere before.
:
:

Try del /q C:\gamedirectory\temp\*.*

if that doesn't work,

echo y | del C:\gamedirectory\temp\*.*

if that doesn't work,

I'm out of ideas. :)

Hope it helps.

---------------------------------------------
I've got a plan, but I'm going to need a dead monkey, some empty liquor bottles, and a vacuum cleaner.

Report
Re: AHHH, the horror!! Posted by KDivad Leahcim on 12 Dec 2001 at 8:38 PM
: Sorry to bug you guys again, but, I got a small problem again. In the game that I'm writing I edit the autoexec.bat file to delete some tempary files in the games directory. I've used the following syntax in the autoexec.bat:
:
: del c:\gamedirectory\temp\*.*
:
: The problem is that it asks for confirmation. ie: press y/n
: I know there is a way around this, I've seen it somewhere before.
:
:

I do this:

deltree /y c:\gamedirectory\temp
mkdir c:\gamedirectory\temp



 

Recent Jobs