actionscript 3 - Is it possible to detect a collision on only a specific colour? AS3 -
i working on game , border drawn around ball.
the border dimensions taken xml file.
the edge of border made using:
linethick = number(xmlcontent.rec[i].look.strokethick); linecolor = int(xmlcontent.rec[i].look.strokehex); drawings.graphics.linestyle(linethick, linecolor); drawings.graphics.beginfill(fillcolor); in create drawings functions
now want know how can detect when ball (that moving around screen) has hit edge?
i thought trying make detect when hits colour black because colour of lines.
is there better way? possible detect colour black , make ball bounce back?
this part of code use gaming, might have change own need: function testcollisions():void { (var i:int = enemies.length -1;i >= 0;i--) { tempenemy = enemies[i]; if (tempenemy.hittestobject(player)) { //this part put code bouncing ball } } }
here testing collision of player on tempenemy. have of tempenemy objects in enemies array. might not efficient works.
Comments
Post a Comment