lundi 28 novembre 2016

Using arrays and hitTest - AS3

from what my friend has told me this SHOULD work but doesn't im getting an error on publishing

var P2hb:Array = new Array(P2char1, P2char2, P2char3);
var P2life:Number = 0;  

addEventListener(Event.ENTER_FRAME, framecheck)
function framecheck(event:Event):void
{
if (P2hb.hitTestObject(P1attack)) { P2life-=2; }
}

This is a generic code but it is the same as what I have basically all elements in the P2hb are movieclips on the stage My friend who recommended I use the array function said this should work but I cant seem to get it to work. Can anyone tell me what I am doing wrong? Thank you in advance.

Aucun commentaire:

Enregistrer un commentaire