Movement « Actionscript Programming « Flash Tutorials

Home
Flash Tutorials
1.Actionscript Programming
2.Animals
3.Animation
4.Colors
5.Design
6.Effects
7.Game Cartoon
8.Humans
9.Models
10.Nature
11.Operations
12.Shapes
Photoshop Tutorials
Maya Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
Flash Tutorials » Actionscript Programming » Movement 
Add Feed to MyYahoo

Helicopter game which moves helicopter character based on key presses from your keyboard.

import flash.display.MovieClip;

Add Feed to MyYahoo

Character Movement: Following the Mouse Zip Archive

I know this could be done far easier then I do it, but there is a lot of great reasons for doing it my way, we have all checks and movements in the enter_frame event, which makes sure that we can actually have two separate movements at once, so if you hold down left key and if we also could set it to jump, it will not jump straight up but up to the left.

startDrag(”aim”,true); Mouse.hide();

Here's another old tutorial that I've bought over from the previous site, showing you how to create nice and simple 8 directional movement with rotation, handy for top down games such as RPG's and the like.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

First, open a new flash file. (If you are using CS3, make sure it is an AS2 file!)

Now we will add hit testing. On the stuff layer, draw a 10 px black line towards the bottom of the stage. Press f8 to convert this to a movieClip called 'MC_wall' with an instance name of 'MC_wall'.

1. First create a new document (Ctrl. + J), dimensions 250 * 200 pixels. 1.1 Select #0030FF as background.

I want the car to come in from the side but not the person controlling it. I used this code to move in the side (which I got off the gravity tut but it changed abit of it) onClipEvent (load) { acc = 9.8; time = 0; fps = 20; } onClipEvent (enterFrame) { time = time+1/fps; this._x -= Math.pow(time, 2)*acc; _root.restart.onPress = function() { _root.aircraft._x = -50; time = 0; }; }

Copyright DesignTutorials.info 2005 | Contact | Privacy Policy

onClipEvent(load){ speed=5; } onClipEvent(enterFrame){ if(Key.isDown(Key.LEFT)&&Key.isDown;(Key.UP)){ this._x-=speed; this._y-=speed; this._rotation=315; } else if(Key.isDown(Key.LEFT)&&Key.isDown;(Key.DOWN)){ this._x-=speed; this._y+=speed; this._rotation=225; } else if(Key.isDown(Key.RIGHT)&&Key.isDown;(Key.UP)){ this._x+=speed; this._y-=speed; this._rotation=45; } else if(Key.isDown(Key.RIGHT)&&Key.isDown;(Key.DOWN)){ this._x+=speed; this._y+=speed; this._rotation=135; } else if(Key.isDown(Key.LEFT)){ this._x-=speed; this._rotation=270; } else if(Key.isDown(Key.RIGHT)){ this._x+=speed; this._rotation=90; } else if(Key.isDown(Key.UP)){ this._y-=speed; this._rotation=0; } else if(Key.isDown(Key.DOWN)){ this._y+=speed; this._rotation=180; } }

First things first, draw a plane... but NOT on the main timeline. Make one in a new movie clip. This will keep the plane contained and easy to manipulate once complete. In drawing, use the grid and grid snapping to help you create your lines. I have my grid snapping at 10 px. Its good to know what yours are set at if you don't already. They determine the size of your grid as you're drawing it. If you want, you can use some checkerboard coloring to help distinguish the squares - like those I've been using in the examples above.

The reason for anyone to know them is that these trigonometric functions are fabulously useful in coding in Flash Adobe. Example? You probably can guess one by the title :-) Yes, circular movement.

1- Start by creating a new Flash file, set the dimentions to 550 x 100. Make the movie run at 30 frames per second.

Open the Macromedia Flash MX and create a new document with the size 345x231 pixels. Import in the stage the picture "clouds.jpg". For this, select File > Import, select the image and click "Open". Now, on the layer "layer 1" you have the picture with the clouds. In the stage, right click on the picture and select Convert to Symbol. In the new window which appears select "Movie clip":

If you've ever wanted to create a game in Flash that uses the arrow keys as the controls, here's the quick and easy way to do it. First, you need to draw the player. I used a circle, but you can use as much detail as you want. Next, make the drawing a movie clip and name it whatever you want (I named mine "player"). Add the player MC to the stage. Finally, you need to add the code. Open the actions for your player movie clip and add the following code:

In order to make the movement smoother, we're going to reduce how frequently the MC switches directions. In order to do that, we'll set a direction variables and increment the _x and _y properties with them. We'll then test a random number to see if we should change the direction variables.

This is the first part of a series of Space Shooter tutorials. In this part we are going to learn the basics of Movie Clips and character movement.

w__w_w_._j__ava2___s___.__co___m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.