00:00
00:00
Newgrounds Background Image Theme

ShogunAfterDark just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

As: Basic Movment (classroom)

1,096 Views | 12 Replies
New Topic Respond to this Topic

As: Basic Movment (classroom) 2006-01-08 07:36:51


Welcome Everyone
To your First Action Script Class! Today i will teach you how to do basic Movement!

Okay get your books out and turn to yesterdays page!

If you look at you picture of Flash MX you can see a Action Panel and Properties Panel! now get your pencils out and draw a Character that you want!

Yes thats right! Something like say a Car of a Spaceship!

Then on you magic table keyboards press F8 and convert this Shape or Car or What ever you done into a movie clip!

Then if your action panel isnt open press F9 and it will open! saying "Actions" at the top left corner of the panel! then make sure the shape is highlighted then put this code in
(dont worry ill tell you what the code is telling flash!

onClipEvent (enterFrame) {
if (Key.isDown(37)) {
_x=_x-2;
}
if (Key.isDown(38)) {
_y=_y-2;
}
if (Key.isDown(39)) {
_x=_x+2; This Code Tells flash how fast to go along the X Axis
}
if (Key.isDown(40)) {
_y=_y+2; And this code does the same but along the Y Axis
}
}

Okay Now test It!
Does it work everyone?

Okay right,

If your making a game and you have a Wall anywere and you dont want a Car going though it know would you!

Yes Bob!

"Well Sir!
if you have a car on that action script it says that i can fly up into the sky and if its a car we dont want that!"

Oh Yes sorry Bob!
okay ill tell you that code again so if you have a car it wont go flying in the sky (but if its a flying car leave the code as it is!)

if (Key.isDown(39)) {
_x=_x+2; This Code Tells flash how fast to go along the X Axis
}
if (Key.isDown(40)) {
_y=_y-0; Now i have changed it to -0 so it wont fly!
}
}

There you go Bob

"Sir"
"Sir"

Yes Steve

"Well Sir,
What happens if you want the car to go really fast!?!"

Well Steve!
all you have to do is change this

if (Key.isDown(39)) {
_x=_x+8; <--- The Higher the Number the Faster the Car or Person will go around on the page!
}
if (Key.isDown(40)) {
_y=_y-0;
}
}

"Thanks Sir!"

No Problem Steve!

Okay everyone Where was i....... Oh yer! so if you have a car and you dont want it go though a wall heres a little something!

okay ill go step by step!

1. Make the Wall!
2. Convert it into a MOVIECLIP
3. Make the Instance= wall
4. Open Actions panel
5. Then Put in this code!

if (hitTest(_level0.wall)==true) {
_x=_x-0;
} <----- This Means that it wont go though the Movie Clip called wall! as you can see i put this bit

(hitTest(_level0.wall)==True <--- There it says the Movieclips name (wall) this means it wont go though it!

"So Sir whats the Whole Code?"

Bob ill tell you it again just for you!

onClipEvent (enterFrame) {
if (Key.isDown(37)) {
_x=_x-2;
}
if (Key.isDown(38)) {
_y=_y-2;
}
if (Key.isDown(39)) {
_x=_x+2;
}
if (Key.isDown(40)) {
_y=_y+2;
}
if (hitTest(_level0.wall)==true) {
_x=_x-2;
}
}

Remember bob this code has the Wall Part included in it to!!

So class i hope you learnt something today!

See you next Class!

(Please email me if any of the codes are wrong i think they are all correct!

CYA

Response to As: Basic Movment (classroom) 2006-01-08 07:37:20


ha ha ha ha


- Matt, Rustyarcade.com

Response to As: Basic Movment (classroom) 2006-01-08 07:42:11


As: Main has everything we need for as!

Response to As: Basic Movment (classroom) 2006-01-08 07:44:37


... Shhhh Bloodskater people are trying to read!

Response to As: Basic Movment (classroom) 2006-01-08 07:56:28


Holy crap you just took up three quarters of the page!
Now you've lost viewers' interest! XP

Response to As: Basic Movment (classroom) 2006-01-08 08:03:22


Yer i guess the Teacher isnt very good at grammer! Silly Sir!

Response to As: Basic Movment (classroom) 2006-01-08 08:09:58


At 1/8/06 08:03 AM, -yoshipros- wrote: Yer i guess the Teacher isnt very good at grammer! Silly Sir!

to be a teacher you have to know what you are doing first. You fail to do this


- Matt, Rustyarcade.com

Response to As: Basic Movment (classroom) 2006-01-08 08:28:13


sorry to say this, but you, good sir, phail.

Response to As: Basic Movment (classroom) 2006-01-16 11:14:33


This is only Basic and im sorry about the spelling!

Response to As: Basic Movment (classroom) 2006-01-16 11:34:00


What the fuck!? You redo a tutorial that already exists, and you copy rantziens little classroom scenario to make it "funny and original"

pointless.

Response to As: Basic Movment (classroom) 2006-01-16 12:38:22


Well i'm a bit of a n00b so my code i have tried is probally totaly wrong. I made this code up but i wasn't sure if it was right. I wan;t to make it so when you press BOTH space(32) and LEFT it goes to frame 6. This is the code i tried:
If (Key.isDown(32))and(Key.isDown(Key.LEFT)){
gotoAndStop(6);}

If you can help with this i will be extremly happy about it!

Please help Mr. "Teacher" Dude, "Sir"

Response to As: Basic Movment (classroom) 2006-01-16 13:21:16


At 1/8/06 08:09 AM, Ninja-Chicken wrote: to be a teacher you have to know what you are doing first. You fail to do this

agreed. i prefer to learn from someone who has a clue as to what they are doing.


BBS Signature

Response to As: Basic Movment (classroom) 2006-01-16 13:34:33


Too many ')'s. Check them carefully, write slowly. It's:
Key.isDown(32)&&Key.isDown(37)?gotoAndPlay
(6):0 .
You had a ')' after the first condition.


BBS Signature