SITE MOVING

NEW WEBSITE, I've moved everything to a new site. Its not just a blog anymore, its a full blown website.

REPEATE!: its not over just moving!

THE WEBSITE IS:
www.bxstudios.weebly.com

CHECK IT OUT FOR LOTS MORE TUTORIALS!

Welcome To Max's Flash Tutorials!

Here I will eventually post everything I know about flash. That ALOT! I am currently working on one of the best and far most interactive games I've ever made. Its called, "The Burbz RPG" and it will release some time in the summer of 08. That takes up a lot of my time but after I release the game on to the internet I will have a lot more time to write up tutorials.

Sections

Saturday, January 12, 2008

Simple 8 Way Movement

Here I'll show you how to add interactivity and make your charector in your game move in all eight dirrections with the arrow keys. Lets Begin...


  1. First draw you charector from a birds eye view (looking from above)
  2. Now Hit "Ctrl + F8"
  3. Now Name it and select "Movieclip"
  4. Then click "OK"
  5. Click on your charector and give it the instince name of "man"
  6. Now put the following script on your character:
  • onClipEvent (load) {
  • fight = false;
  • }
  • onClipEvent (enterFrame) {
  • if (fight == false) {
  • if (Key.isDown(Key.LEFT) && fight != true) {
  • _rotation = 270;
  • this._x -= 5
  • }
  • else if (Key.isDown(Key.RIGHT) && fight != true) {
  • _rotation = 90;
  • this._x += 5
  • }
  • if (Key.isDown(Key.UP) && fight != true) {
  • _rotation = 0;
  • this._y += 5
  • }
  • else if (Key.isDown(Key.DOWN) && fight != true) {
  • _rotation = 180;
  • this._y -=5
  • }
  • }
  • }
  • onClipEvent (enterFrame) {
  • if (Key.isDown(Key.LEFT) && Key.isDown(Key.DOWN)) {
  • _rotation = 225;
  • }
  • if (Key.isDown(Key.RIGHT) && Key.isDown(Key.UP)) {
  • _rotation = 45;
  • }
  • if (Key.isDown(Key.RIGHT) && Key.isDown(Key.DOWN)) {
  • _rotation = 135;
  • }
  • if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
  • _rotation = 315;
  • }
  • }

And there you go! Now test your movie/game by hitting "Ctrl + Enter". That will create an swf file (thats the actual movie/game file that you would give to your friends or upload to the internet.

2 comments:

Rolando Garro said...

I think hitTest function is mising somewhere

Max said...

no hit test is required for this step, this only makes your player rotate in the right direction by pressing the arrow keys. This DOES NOT move your charector, it just rotates him/her.