The Daily Click ::. Forums ::. Klik Coding Help ::. Random Movement.....?
 

Post Reply  Post Oekaki 
 

Posted By Message

Sephirenn

Possibly Insane

Registered
  15/01/2002
Points
  2343

360 OwnerPS3 OwnerWii OwnerI am an April FoolVIP MemberGOTW JUNE 2010 WINNER!
16th August, 2003 at 17:56:23 -

I've got a good idea for the theme of a game. The gamplay is just betting on which horse is going to win the race... but i've got no idea how to get the "race" to be random everytime. ive been trying something like "every 1 second... set speed of teal racer to blah" but thats nt random and the race will be the same everytime. i can could use some suggestions either for the default path or bouncing ball movement, or if its easier and obviously more customizable, i could use some suggestions with a custom engine movement. thanks for any and all help!

 
*Sephirenn*

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
16th August, 2003 at 18:37:57 -

There is a Random expression. Eg:

Always - Set horse speed to random(25)

this will set the horses speed to a random integer between 0 and 24, which is 25 numbers. So what you could do is make them have bouncy ball movement and set their direction to right, then always set their speed to random(25).

-Andy

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

ShadowCaster

Possibly Insane

Registered
  02/01/2002
Points
  2203
16th August, 2003 at 19:31:07 -

I would be more inclined to make the speed +/-5 of the current speed, that way the horse wont be traveling at 25 then all of a sudden stop (relitavely speaking) at speed 1.

I.e.

+ Every 1 Second
- Set Speed of Horse to Speed("Horse") + (Random(10) - 5)

+ If Speed("Horse") < 1
- Set Speed of Horse to 1

+ If Speed("Horse") > 25
- Set Speed of Horse to 25

You may also be able to do something using acceleration instead, so that you dont get sudden jumps in speed, though that will require a bit more work.

Commandant

 
"Now I guess we're... 'Path-E-Tech Management'" -Dilbert

ShadowCaster

Possibly Insane

Registered
  02/01/2002
Points
  2203
16th August, 2003 at 19:32:56 -

Just continuing from that:

Out of the gate you should probably set the speed to a random number, say, from 15-25. Otherwise they're going to all start out really slow and slowly build up speed.

Commandant

 
"Now I guess we're... 'Path-E-Tech Management'" -Dilbert

Sephirenn

Possibly Insane

Registered
  15/01/2002
Points
  2343

360 OwnerPS3 OwnerWii OwnerI am an April FoolVIP MemberGOTW JUNE 2010 WINNER!
16th August, 2003 at 20:23:35 -

i didn't know there was a random expression... that makes things sooo much easier! and that example helps a lot to get me started. thanks a ton guys.

 
*Sephirenn*
   

Post Reply



 



Advertisement

Worth A Click