Posted By
|
Message
|
Del Duio Born in a Bowling Alley
Registered 29/07/2005
Points 1078
|
19th July, 2007 at 10:44:21 -
I'm like 99% positive this is right, but if I want to return a random value for a number from the 1-9 range, the code is this right?
Random( 8 ) + 1
Because it counts zero? I have this code already in my game so I hope it's right. Thanks!
Edited by the Author.
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
|
Joe.H Evil Faker
Registered 19/08/2002
Points 3305
|
19th July, 2007 at 11:01:29 -
random( 9 ) +1
random( x ) returns the interval [0,x-1]
therefore you need to add one to get the interval [1,x]
Edited by the Author.
My signature is never too big!!!
|
Del Duio Born in a Bowling Alley
Registered 29/07/2005
Points 1078
|
19th July, 2007 at 11:03:33 -
Are you sure Joe? Wouldn't that give me the result of 1-10 instead?
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
|
markno2
Registered 06/06/2006
Points 865
|
19th July, 2007 at 11:03:42 -
Needs to be Random(9)+1
Random( only counts 0,1,2,3,4,5,6,7. Adding one makes that range 1-8
Discarded pizza boxes are an indispensable source of cheese.
|
Del Duio Born in a Bowling Alley
Registered 29/07/2005
Points 1078
|
19th July, 2007 at 11:05:13 -
The three times I've tested this in-game I've gotten the results of 1, 5, and 6.
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
|
Del Duio Born in a Bowling Alley
Registered 29/07/2005
Points 1078
|
19th July, 2007 at 11:06:15 -
Oh, I get you now, man that's really a weird way to do it isn't it? Thank you!
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
|
Joe.H Evil Faker
Registered 19/08/2002
Points 3305
|
19th July, 2007 at 11:08:38 -
random ( x ) literally tells MMF to create a random number out of x numbers, from 0 to (x-1).
I.e you have random( 5 ) will be 0,1,2,3,4 but this is 5 numbers.
My signature is never too big!!!
|
Tim I'm on here way too much
Registered 25/08/2006
Points 132
|
19th July, 2007 at 12:12:35 -
Yeah, though "0" isn't an amount of anything, it is still a value.
NULL or "" = nothing / blank value/field
"0" = something, not a blank field.
Stuff like this is really annoying I'll admit.. along with that whole inverted Y axis thing so + = down ¬_¬ It hurts my maths brain
http://www.SilverNova.co.uk
|
Joe.H Evil Faker
Registered 19/08/2002
Points 3305
|
19th July, 2007 at 14:11:03 -
Just think of it like this:
you have a 350x350 frame:
Top left = (0,0)
Bottom right = (349,349)
Therefore to go from left to right you add 1 to x.
From top to bottom you add 1 to y.
My signature is never too big!!!
|
Matt Boothman The Nissan Micra of forum members
Registered 20/09/2002
Points 109
|
19th July, 2007 at 14:44:44 -
Why don't you read this informative and insightful article: http://www.create-games.com/article.asp?id=1633
http://soundcloud.com/normbo - Listen to my music.
|
Tim I'm on here way too much
Registered 25/08/2006
Points 132
|
19th July, 2007 at 14:53:40 -
Haha, now how did I guess that you where the author? (rhetorical.)
http://www.SilverNova.co.uk
|
Del Duio Born in a Bowling Alley
Registered 29/07/2005
Points 1078
|
20th July, 2007 at 06:32:38 -
The most insightful thing I learned from that article is that YOU ARE NOODLE!!
Hello, I thought you were gone for good or something lol.
I fixed the random number part of my game, thanks everyone
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
|
Matt Boothman The Nissan Micra of forum members
Registered 20/09/2002
Points 109
|
20th July, 2007 at 06:56:16 -
Lole. My renaming was gradual - I don't know how you didn't spot it.
http://soundcloud.com/normbo - Listen to my music.
|
|
|