News:

If you need instructions on how to get through the hotels, check out the enclosed instruction book.

Main Menu

Actionscript Academy Session 1

Farted by RomanClock, May 25, 2007, 05:28:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

RomanClock

Actionscript Academy Session 1
Friday 25, AIM , or specify something else.

Today we will be working on mouse movement games such as fancy cursors and mouse avoider games. If you don't know anything about AS at all, skim this.

I WILL BE CONSTANTLY UPDATING THIS POST, IM ME IF YOU NEED HELP!

You can post finished projects here.

First Step is simple, just to make it follow the mouse.
[flash]http://img182.imageshack.us/img182/97/session1azk0.swf width=200 height=200[/flash]
This black dot simply follows the mouse.

1. Draw something
2. Turn it into a movie clip, name does not matter.
3. Give it the Instance Name follow
4. Open the Actions panel and click on the frame
5. Make sure it says Frame on the panel title.onEnterFrame = function () {
follow._x = _xmouse;
follow._y = _ymouse;
};

Step 2: Lets make some walls!
[flash]http://img186.imageshack.us/img186/4686/session1bph8.swf width=200 height=200[/flash]
This black dot follows the mouse, but if you move over the red, it will appear back at the start. You can mouse over the dot to make it follow the mouse again.

1. Draw walls and make it into a SINGLE move clip, name doesn't matter.
2. Give it the Instance Name wall
3. Add the new codes [B]following = false;[/B]
onEnterFrame = function () {
[B]if (following == true) {[/B]
follow._x = _xmouse;
follow._y = _ymouse;
[B]}
if (following == false) {
follow._x = 100;
follow._y = 100;
}
if (wall.hitTest(_xmouse, _ymouse, true)) {
following = false;
} else if (follow.hitTest(_xmouse, _ymouse, true)) {
following = true;
}[/B]
};

Step 3: UR A WINNAR
[flash]http://img186.imageshack.us/img186/9599/session1cib9.swf width=200 height=200[/flash]
This counts how many times you lost and if you hit the blue circle you win!

1. Type "Tries" or something with regular STATIC TEXT in the top corner
2. Create a DYNAMIC TEXT BOX (located in the properties panel, its in a drag down box that might says Static)
3. Look in the bottom right corner of the properties panel, you'll see a box with the word Var: next to it, type par in that box
4. Make a blue circle and turn it into an MC, give it the Instance Name win
5. now make a new frame (frame 2) and make a win picture or something, turn it into a movie clip.
6. Go inside the movie clip and add about 30 to 60 frames, the last frame should be a keyframe
7. In that last keyframe, type _root.gotoAndStop(1);
8. Now head back to the first frame on the main time line to add this code: [B]stop();
par = 0;[/B]
following = false;
onEnterFrame = function () {
if (following == true) {
follow._x = _xmouse;
follow._y = _ymouse;
}
if (following == false) {
follow._x = 100;
follow._y = 100;
}
if (wall.hitTest(_xmouse, _ymouse, true)[B] && following == true[/B]) {
following = false;
[B]par++;[/B]
} else if (follow.hitTest(_xmouse, _ymouse, true)) {
following = true;
}
[B]if (win.hitTest(_xmouse, _ymouse, true) && following == true) {
nextFrame();
}[/B]
};
lemayo lol :soups:

FluxCapacitorClock

Quote who're you?
Vibrator
never heard of you
yes
:O
Oh well =\
but you've probably heard of me
i'm the leader/god of the clock crew
I thought that was Strawberry o_O
lmaao
Hmm... perhaps I've been horribly misguided!
obviously
I have, seen you 'round, Coal. Not really 'heard' though.
strawberry died a couple of years ago :\
I like your siggy -^_^-
f'real
No he didn't!
yes he did!!
Shark Farming accident
it was all over the bloody news!
Well..
shark farming
maybe "SBC" did, but certainly not the person!
no, the person
SBC lives on in our flashes only as a mascot
I thought he would've died to the mass of CC members retaling due to his, trying to forget the CC for that new flash place he's working with on, I believe, adult swim?
Pisha!
ill never look at shark farmers the same way again =(
that's just our cover up, the whole sbc story
we like to fool around with Newgrounders
*jaw drops* Flux Capacitor!
Why is there a "2" next to my name? o_O
you fucking clockfriend
Rawr.
-^_^-
meow =^.~=
mew? o.o
o_o;
o3o
AW!
Oh
I see why.
haha.
I feel stupid.
heh ^^;
I had another tabe open with the chat and I reopened another one, and since the name"Vibrator" was already being used, they stuck a 2 next to my name
HEY GUYS
*sets lighter fluid and flame to coal*
HEY ROMAN
Don't tell me I'm disloyal!
JUST GO TO THE TOPIC AND TALK THERE
JAVA CHAT IS SLOWING MY COMPUTER
*** Vibrator2 has quit (QUIT: User exited)
*** Vibrator2 has joined #clockcrew
vibrator do you wanna get the fuck banned
Not particularly.
don't talk to me like that ever again
i'm the almighty lord of the clock crew
You're the ony who was all "You're disloyal"
PFFFT!
Good Bye!
AW :(
i'll see you hung from the gallows
with that attitude
*** RomanClock has quit (QUIT: User exited)
Yay!
Hempman rope come aide me to the light!
i must take my leave
but take heed clockfriend
know who your superiors are...
bitch

Coal instructed me to post this he threatened harm would befall my dicks if I didn't


Solenoidclock

I really want to be here for this, but my IP has been blacklisted. Will someone with chat powers please fix this glitch?
Quote from: FlondermenKlok;1578925I wonder if I could get really obese and masturbate by jiggling my fat around.


RomanClock

Quote from: Trek Clock;829362Done
[flash]http://i3.photobucket.com/albums/y84/genex89/x.swf[flash]

Try a higher frame rate to make it smoother :)
I usually use 30 FPS
AS works better at higher frame rates without any extra effort for you. I suggest 30 because its good all around.
lemayo lol :soups:

Trek Clock

following = true;
onEnterFrame = function () {
if (following == true) {
follow._x = _xmouse;
follow._y = _ymouse;
}
if (following == false) {
follow._x = 100;
follow._y = 100;
}
if (wall.hitTest(_xmouse, _ymouse, true)) {
following = false;
} else if (follow.hitTest(_xmouse, _ymouse, true)) {
following = true;
}
};

CapitalistClock





SockpuppetClock

I tried adding easing to the mouse's movement, and it's working out well.

[flash]http://img138.imageshack.us/img138/1048/mousegamelm2.swf width=400 height=200 wmode=transparent[/flash]
following = false;
Mouse.show();
onEnterFrame = function () {
if (following == true) {
xMove=(_xmouse-follow._x)/5
yMove=(_ymouse-follow._y)/5
follow._x+=xMove
follow._y+=yMove
Mouse.hide()
}
if (following == false) {
follow._x = 70;
follow._y = 66;
Mouse.show();
}
if (wall.hitTest(_xmouse, _ymouse, true)) {
following = false;
} else if (follow.hitTest(_xmouse, _ymouse, true)) {
following = true;
}
};

THE HELVETICA SCENARIO

[u2]aY7XH2ulTEU[/u2]

CapitalistClock

Quote from: SockPuppetClock;829407I tried adding easing to the mouse's movement, and it's working out well.

[flash]http://img138.imageshack.us/img138/1048/mousegamelm2.swf width=400 height=200 wmode=transparent[/flash]
following = false;
Mouse.show();
onEnterFrame = function () {
if (following == true) {
xMove=(_xmouse-follow._x)/5
yMove=(_ymouse-follow._y)/5
follow._x+=xMove
follow._y+=yMove
Mouse.hide()
}
if (following == false) {
follow._x = 70;
follow._y = 66;
Mouse.show();
}
if (wall.hitTest(_xmouse, _ymouse, true)) {
following = false;
} else if (follow.hitTest(_xmouse, _ymouse, true)) {
following = true;
}
};

Where did you put the easing?

Also, i tried editing some stuff and i think i've gotten basic knowledge of this shit.

RomanClock

Quote from: SockPuppetClock;829407I tried adding easing to the mouse's movement, and it's working out well.

[flash]http://img138.imageshack.us/img138/1048/mousegamelm2.swf [flash]

Lol, show off :) Were not doing that yet
lemayo lol :soups:

SockpuppetClock

Quote from: Tyler Durden;829425Where did you put the easing?

Also, i tried editing some stuff and i think i've gotten basic knowledge of this shit.

following = false;
Mouse.show();
onEnterFrame = function () {
if (following == true) {
[B]xMove=(_xmouse-follow._x)/5
yMove=(_ymouse-follow._y)/5
follow._x+=xMove
follow._y+=yMove[/B]
Mouse.hide()
}
if (following == false) {
follow._x = 70;
follow._y = 66;
Mouse.show();
}
if (wall.hitTest(_xmouse, _ymouse, true)) {
following = false;
} else if (follow.hitTest(_xmouse, _ymouse, true)) {
following = true;
}
};


Quote from: RomanClock;829426Lol, show off :)
:o

RomanClock

Quote from: SockPuppetClock;829427:o

Don't make me use my laser codes
lemayo lol :soups:

Topcatyo



SageClock

Wow, this actually seems to be going pretty well so far.  Too bad I'm too busy with stupid reports at work, or I might have joined in on the fun.