Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
pyromaniac886
16
Years of Service
User Offline
Joined: 1st Mar 2010
Location:
Posted: 18th Apr 2010 02:53
I'm creating a game at the moment but i have yet to get my random movement script to work. here's the code:

if anyone could tell me what i'm doing wrong or give me a better random movement command that would be much appreciated
=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 18th Apr 2010 03:32
You have...

enemy1_move = rnd(1-4)

1-4=-3, and you can't rnd a minus number, it just returns 0

where as what you probably mean is

enemy1_move = rnd(3)+1

Judging from your code, this will give you a random number between 1 and 4. Rnd(3) will give 0 to 3, +1 will give you 1 to 4

Hope that helps

pyromaniac886
16
Years of Service
User Offline
Joined: 1st Mar 2010
Location:
Posted: 18th Apr 2010 21:42
Ah thanks! yeah i guess i just had the pick random command wrong.

Login to post a reply

Server time is: 2026-07-26 07:36:08
Your offset time is: 2026-07-26 07:36:08