1. loop

------=_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&nbsp;AI&nbsp;, 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>&nbsp;</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--

new topic     » topic index » view message » categorize

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...

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu