Internet Commerce

Partners & Affiliates

Developer Channel


Featured Flash FLA
Gallery Downloads 11401 Flash Movies | 5 New Flash Movies Added
What's New | Top 100

Featured FLA

»  Author Miguel Panos
»  Title: Tarta
»  Description: It is a circle graph or pie chart that takes the data entered by user
»  More by Miguel Panos


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 4839 Flash Sites | 1 New Flash Links
What's New | Top 100 Flash Site

Featured Site

»  AuthorDeft Creative Ltd
»  Link: Home Page
»  Description: Portfolio site for .DeftCreative Ltd. A UK based web design studio specialising in flash websites, games and interactive CDROMs. With an emphasis on making things different.


Random Links | Add your own Flash Related Links
Flash Tutorials 1484 Tutorials 7 New Tutorials Added!
What's New | Top100

» Making Automatic Training Screen Capture Easily
» Create Undersea Life Animation
» Making Deinterlace Video with a low bitrate Easily
» How To Make A Simple Animation Using Christmas Clips
» Simple Step by step flash game tutorial Spot the diffrence
» How To Make A Moving Text Slide
» Create Flash Banner With Text Float Effect
» How To Make Zoo Photos Slideshow
» How To Make A Dolphin Photos Slideshow
» Unknown Tag: Title10
Random Tutorial | Add Site


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Games

Categories Boundarys or Walls in Games
Author: CorkySurprise | Website: www.freewebs.com/corkyandtooky |

 
Page 1
1

OK, if you’ve read any of my previous tutorials before you will know I’m an expert at making something simple into something complicated. I’ll try not to do that here… Ok let’s get started! Open up Flash MX or Flash MX 2004 and create a MC (Movie Clip (F8)) and give it an Instance name of Character. Now give it the following Script: onClipEvent (enterFrame) { if (Key.isDown(Key.LEFT)) { _x = _x-10; } if (Key.isDown(Key.UP)) { _y = _y-10; } if (Key.isDown(Key.RIGHT)) { _x = _x+10; } if (Key.isDown(Key.DOWN)) { _y = _y+10; } } This will allow your character to move. Next, create the Vertical left side of the border. This may confuse you, so imagine opening up Word and drawing a Vertical line on the left side of the screen. It that didn’t help imagine a box, the left line on that), MC it and give it an Instance name of wall. Back to the character, and give it the following script: onClipEvent (enterFrame) { if (this.hitTest(_root.Wall)) { _x = _x+10; } } This means that if the movie clip called character comes into contact with a MC called wall, the X position (if it were on a graph) will be reduced by 10. Now make the horizontal top line of our “border”. MC clip it, and give it an instance name of Wall2. Back to the character, and give it the following script: onClipEvent (enterFrame) { if (this.hitTest(_root.Wall2)) { _y = _y+10; } } Now make the horizontal bottom line of our “border”. MC clip it, and give it an instance name of Wall3. Back to the character yet again, and give it the following script: onClipEvent (enterFrame) { if (this.hitTest(_root.Wall3)) { _y = _y-10; } } YAY only one more to go! Now make the vertical right line of our “border”. MC clip it, and give it an instance name of Wall4. Back to the character for the last time and give it the following script: onClipEvent (enterFrame) { if (this.hitTest(_root.Wall4)) { _x = _x-10; } } And there you go- you’re all set up! Good luck with Flash -Corkysurprise

1

» Level Basic

Added: : 2004-12-27
Rating: 6.26 Votes: 23
Hits: 224
» Author
Likes Flash when it works- Hates it when it doesn't
» Download
Download the files used in this tutorial.
Download (9 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments