View Single Post
Old 2nd July 2009   #1 (permalink)
flashedchris
Forum Junior
 
 
Level: 9
Level up: 39%
Activity: 0%
Posts: 386
Status: Offline
Default Flash Tutorial: Enemy Missiles

Make sure you have the program MACROMEDIA FLASH version 7 or higher

1.) Open Flash

2.) Select NEW FLASH DOCUMENT

3.) Create or Upload your Missile image and convert to movie clip.

4.) Click the drop arrow and select EXPORT FOR ACTIONSCRIPT and EXPORT IN FIRST FRAME


5.) (after object is created) Go to FILE>NEW>ACTIONSCRIPT FILE

6.) paste the code below into that spot.

class EnemyMissile extends MovieClip
{
var speed;

function onLoad()
{
speed = -20;
}

function onEnterFrame()
{
_x += speed;

if(this.hitTest( _root.ship) )
{
this.removeMovieClip();
_root.ship.updateHealth(-10)
}

if(_x < 0)
{
this.removeMovieClip();
}
}
}




7.) Save the document as class.as in the same folder your SWF is in
(example: Class-EnemyMissile I wold save it as EnemyMissile.as)

8.) Save the SWF in the same folder as the actionscript

TEST MOIVE to check if works

if anyone needs a tutorial/question, please notify me and I will try to help/asses the problem/help/tutorial/
Reply With Quote