THANK YOU SO MUCH! I have been looking for the answer to this all day!
Just trying to understand your actionscript, why can't we say
'var random_number = random(13)'? Why must there be a +1?
Also, what is a var?
Thanks![]()
THANK YOU SO MUCH! I have been looking for the answer to this all day!
Just trying to understand your actionscript, why can't we say
'var random_number = random(13)'? Why must there be a +1?
Also, what is a var?
Thanks![]()
var is the creation code for a variable in flash.
Woops, I messed up with that code. It should be random(13) + 1;
Why do we say 13 + 1? In computer stuff, we usually start with the number 0 instead of 1. If you have a list or an array of numbers, we refer to the first place as 0, the second as 1, and so on.
With the random function, it will spit out 1 of 13 numbers. However, the number 0 is included. This means it will spit out 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, or 12, if you put 13 in it. So, we need to add 1 to the final number to get from 1-13.
Sorry about that mistake.
Please ask anything else that seems fishy. I'm currently playing a game, so half my attention to detail is gone. xD
Last edited by Vlykarye; 03-18-2012 at 04:27 AM.
So doesn't that mean you could just write 'random(14)'?
Thank you so much btw, would it be ok if I emailed you with my little AS2 dilemmas from now on? How long does it usually take you to reply? I would really appreciate that![]()
If you use random(14), then you might get a 0, but there is no such thing as a 0th frame in flash. Frames start at 1.
I'll give you a different email address by emailing you. You can use that and i'll answer pretty quickly.
Thank you so muchAlso, what is a var? Where can I learn more about AS2 and AS3?
var is a type. Google search what programming types are.
If you want to learn the difference between AS2 and AS3, then google search that as well. I'm not the best teacher for flash anymore since I program in C++ now.
I can help with certain flash things because I have had a lot of experience with it, but I don't know too much off the top of my head anymore.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks