The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.34 / 5.00 31,296 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.07 / 5.00 10,082 ViewsI'm an aspiring Flash MX 2004 artist and scripter, but not yet a very good one. So, I read Flash and ActionScript books, take classes, and read online tutorials to try to get better.
To help myself retain what I learn, I thought it might be a good idea to make a topic where I summarize what I learn in a post or two now and then. Plus, I might help out other AS newbs.
Should I do this? Maybe, maybe not. But, what the hell, it'll be good for me. So, to start it off...
(just don't expect me to be entirely clear)
6.13.07 Randomly Shaking MCs (also, random vars in general)
Resources-
http://toxiclab.org/tutorial.asp?ID=72
http://www.tutorialized.com/view/tutorial/Fla sh-Random-Effects/25986
First, how to declare (make) a random var in AS:
var x = random(5);
This is literally: "new variable x is now a random number between 0 and one less than 5." This combined with a code for movement on the x or y axes accomplishes the shake effect, as in this code, to be put in your main movie clip's coding:
onClipEvent(enterFrame){
var n = random(5);
_x = n;
_y = n;
}
This is literally: "on each tick of the frame rate (I use 30 FPS), do this: declare new random variable, then move clip on the x and y axes between 0 and one less than 5 times [moving from start point, the top left corner of the movie stage]."
I have to admit I'm only assuming that it's moving from that starting point, otherwise known as (0, 0). It sure seems like it. From where the MC shakes definitely has to do with how the brush drawing within the MC is positioned in accordance with the central "crosshairs".
If you'd like the movie clip to shake in place, follow the code cited in the Toxiclab.org tutorial address I gave earlier. The code is a little bit harder and more complex, but not difficult to understand. It also shows how to use the "_alpha" thing in conjunction with random variables, creating a random opacity effect.
I'm sure there's a way to do it all that which follows the code I made (with the help of the two given sources) more closely, and if I find it, I'll show it later.
To recap, I now know how to make a random variable, use "_x , _y" things, and make a shaky effect.
Yeah, I've seen it happen before and work. You should try and go to Flash 8 though.
MY E-PENIS IS BIGGER THAN YOURS
8=================================>
...and this is my fag...
This is from a few days ago:
6.10.07 Basic Movement a la Legend of Zelda: Link to the Past (from Sina Iman, the Toast guy)
I've gotten some valuable advice from Sina about how the most basic movement, from left to right, works in Toast of War. You simply throw it on a movie clip's actions panel, and it'll go.
onClipEvent(enterFrame) {
if(Key.isDown(Key.RIGHT)) {
_x += 10;
}
if(Key.isDown(Key.LEFT)) {
_x -= 10;
}
if(Key.isDown(Key.UP)) {
_y -= 7;
}
if(Key.isDown(Key.DOWN)) {
_y += 7;
}
}
That's literally: "On each tick of the framerate (again, 30 in my case) do this: if any of these keys are pressed, have the MC go a certain amount right, left, up, or down from its current position."
Recap: This teaches how to put your keyboard to work in a Flash file, as well as how to move an MC a certain amount in one direction or another on each axis.
I should mention for my last post that, of course, the code only makes an MC move in 4 directions, and does not change the MC to follow that movement. That's for another day, when I understand that.