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...
|
Not Categorized, Please Help
|
|