|
-
Hi, I was just fooling around with koolmoves and decided to see if I could make a "magic 8 ball".
Just wanted to see what you think about it. This was my first attempt at action scripting, and I think it works ok.
here it is:
http://pages.prodigy.net/cirrus97/swf/8ball.html
there is also a link at the bottom of the page to download the zip file that has the .fun file and the graphics I used.
Koolmoves and the help I found here really made this easy!
Thanks everyone for the help in your posts.
Ed
-
Very clever...
Random action Script... Right?
-
I like it.
Very nice.
I'm working on a Missle command game if I get time to finish it, I'll post it.
It would be nice if we could have the deprciated Flash 4 Random(X); action, which returns a random number between 0-X instead of fiddling around with the math.random() function which only returns a random number between 0-1.
Although I noticed that you used Math.floor(Math.random()*20)+1
I haven't played twith Math.floor yet, what does it do exactly.
-
Math.floor(x)
floor() method returns the number x rounded up to an integer less than or equal to x
txt1=Math.floor(3.4); // will return 3
txt1=Math.floor(-3.4); //will return -4
-
I got it figured out;
This will return a random value between n1 and n2:
Math.round(Math.random()*(n2-n1))+ Math.round(n1);
and this will return a value between 0 and the value
Math.round(Math.random()*(Value))
I have always used Math.round to get whole intergers instead of Math.floor but either way seems to work.
-
When Math.Round converts a floating point number to the nearest integer, the answer will depend on the fractional value of the number. Postive number with fractional portion less that .5 and negative number with fractional portion greater than .5 are rounded down whereas postive number with fractional portion greater that .5 and negative number with fractional portion less than .5 are rounded up.
Math.round(1.4) will give you 1 but Math.round(1.5) will give you 2
In Math.floor the fractional value does not make a difference
Both Math.floor(1.4) and Math.floor(1.5) will return 1
In this case it does not make a difference though -- just a matter of technicality.
-
Can we post your 8 ball on koolface? very nice work.
-
Of course you can...
thanks for the kind words 
Ed
---------------------------------------------------
Originally posted by gonedigital
Can we post your 8 ball on koolface? very nice work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|