1. loop
- Posted by | <mwfch at MWEB.CO.ZA>
Jun 26, 2000
------=_NextPart_000_0007_01BFDF87.AF3183A0
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
i programed a badguy with AI , well almost AI . The problem is that he =
moves at the speed of light . How can I slow him down ?=20
Thanks.
Ferdinand Greyling
from
Terminal Software
------=_NextPart_000_0007_01BFDF87.AF3183A0
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>i programed a badguy =
with AI , well=20
almost AI . The problem is that he moves at the speed of light . How can =
I slow=20
him down ? </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thanks.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Ferdinand Greyling</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>from</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Terminal =
------=_NextPart_000_0007_01BFDF87.AF3183A0--
2. Re: loop
Ferdinand wrote:
> i programed a badguy with AI , well almost AI . The problem is that he
> moves at the speed of light . How can I slow him down ?
You could:
i) Do other things before moving the bad guy each time:
while not quitting() do
move_other_stuff()
do_other_game_stuff()
move_bad_guy()
end while
ii) Like you hinted at in the subject, you can run a null loop:
while bad_guy do
for wait = 1 to 1000 -- make 1000 bigger to slow bad guy down
-- do nothing for a bit
end for
move_bad_guy()
end while
iii) Use the time() comand to write a delay routine for the bad guy. Or
anything else in the game for that matter...
iv) Combine (i) and (ii):
game_clock = 0
while not quitting() do
do_other_stuff()
if remainder(game_clock, 1000) = 0 then
move_bad_guy()
end if
game_clock += 1
end while
HTH,
Carl
--
Tie me .siggyfile down sport, tie me .siggyfile down...