The Daily Click ::. Forums ::. Klik Coding Help ::. Question about using Random in coding
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

master of hardstyle

Registered
  11/3/2008
Points
  100

Wii OwnerVIP Member
4th January, 2011 at 9:10:11 PM -

So for example lets say i have an object that has none of the default animations used, so all 12 of them are blank. lets say i have 4 more animations after that, lets call them animation A, B, C, and D.
from what i understand from looking at other peoples coding, in order to skip those first empty frames you have to put set animation to Random(12)+4 (12 being the first animations, and 4 being the last 4 you actually want to display)

am i correct? or does the first animation count as animation 0? therefor making the coding Random(11)+4?
or am i completely misunderstanding these lines of coding?

 
[Game design makes my brain feel like its gonna explode.]

OMC

What a goofball

Registered
  5/21/2007
Points
  3045

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
4th January, 2011 at 9:25:32 PM -

Random(4)+13 should do it.

Random() generates a number between 0 and the number you enter (including 0). So the possibilities for Random(4) are 0, 1, 2, and 3. If you add 13 to each of these, the possibilities are 13, 14, 15, and 16.

That should do it... Seems complicated, but at least you're not dealing with a system that always generates a decimal number between 0 and 1 no matter what!

Edited by OMC

 

  		
  		

siven

master of hardstyle

Registered
  11/3/2008
Points
  100

Wii OwnerVIP Member
4th January, 2011 at 9:32:33 PM -

oooooooooooh! that makes plenty of sense! thank you sir, i think you may have just aided me in fixing a glitch ive been trying to fix for about a week strait. Its been driving me crazy lol.

 
[Game design makes my brain feel like its gonna explode.]

Mark McCauley



Registered
  2/18/2009
Points
  263

Has Donated, Thank You!VIP Member
5th January, 2011 at 10:25:50 AM -

be a good idea to do

set value to 13+random(4)
rather than random(4)+13

because (I think ) the computer will treat the latter as random(17)

 
http://www.reddwarf.co.uk/forum/messages.cfm?threadid=44227736-C46F-AC56-02EBA05285818C14

Jon Lambert

Administrator
Vaporware Master

Registered
  12/19/2004
Points
  8225

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
5th January, 2011 at 1:31:08 PM -


Originally Posted by Mark McCauley
be a good idea to do

set value to 13+random(4)
rather than random(4)+13

because (I think ) the computer will treat the latter as random(17)

No, it won't, because the +13 is outside of the parentheses.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

..::hagar::..

Administrator
Old klik fart

Registered
  2/20/2002
Points
  3029

You've Been Circy'd!
5th January, 2011 at 2:06:48 PM -

A+B = B+A

 
n/a

Mark McCauley



Registered
  2/18/2009
Points
  263

Has Donated, Thank You!VIP Member
6th January, 2011 at 12:20:07 PM -

OBVIOUSLY, it is outside the brackets ,
but I could've sworn the computer has treated the number as a whole before , maybe its just my schizophrenic pc.anyone ever have this happen to them?
but thanks for the correction.

 
http://www.reddwarf.co.uk/forum/messages.cfm?threadid=44227736-C46F-AC56-02EBA05285818C14
   

Post Reply



 



Advertisement

Worth A Click