PDA

View Full Version : [AS3] adding enemys 2 a game


fastboy619
05-10-2011, 10:38 PM
how can i make enemys for a Vertical Shooter game
can someone give me a sample code in As3


-thanks:)

scorpion9
05-10-2011, 10:43 PM
:D thats one of the most ambiguous questions ive seen.

it all depends of your game...and what kind of enemies there are.


anyways...to make a new of anything, use new keyword
if you have a movieclip class of an enemy then
var enemy:Enemy = new Enemy();
this.addChild(enemy)

fastboy619
05-10-2011, 10:46 PM
im codding on the timeline

ioSONOvittoria
05-10-2011, 10:58 PM
To make enemies you should make a class (.as) and import that class into your .fla file. In your initializing function (the function in your class that has the same name as your class) you should set the attributes of the enemy such as strength and position. Within that class you should also create functions such as EnemyHasBeenHit, EnemyGainsHealth that interactive with events on the stage. But your question is to vague for anyone to answer affectively in great detail (without coding a whole game ourselves).

Mazoonist
05-11-2011, 01:42 AM
Try my tutorial: http://theflashconnection.com/content/flash-as3-left-right-shooter-game

fastboy619
05-11-2011, 02:10 AM
thanks