lundi 28 novembre 2016

Flash CS6, Making Enemies Move

I want to know how to make an enemy move in random directions on flash. It can be up/down or left/right. The following is my code for creating the enemy.

function createEnemy():Void  
    var tempNewEnemy:MovieClip = _root.attachMovie("enemy_mc", "enemy"+_root.getNextHighestDepth(), _root.getNextHighestDepth());

    //set a random x&y
    tempNewEnemy._x = random(Stage.width)
    tempNewEnemy._y = random(Stage.height)

    //add it to the enemyArray

    trace("Enemy created: "+tempNewEnemy)

Aucun commentaire:

Enregistrer un commentaire