*to make things simple i need that turret object can shot enemies within range (range is a turret var).
*and how do i upload my cpx to scirras db?
because i did make a waypoint system for enemy waves and want to share it.
if there's a way for me to learn how to convert my code into events i will be happy for advice about that.
it will be cool to have guides for programers to convert there code to events.
thats the orignal game i started to make with flashpunk:
yoelscripts.cowhosting.net/flashpunk%20_source/td.swf
thats the code:
private function obtainTarget():void
{
?if (!active1) { return; };//exit//if not active do nothing
?//trace("bla");
?var _loc_1:Array = null;
var _loc_2:int = 0;
?var targ_enemy:enemy = null;
?
?
?shot_delay_count += FP.elapsed;;
?if (shot_cooldown < shot_delay_count)
?{
//new array
_loc_1 = [];
world.getType("enemy1", _loc_1);
_loc_2 = 0;
while (_loc_2 < _loc_1.length)
{
//trace("in");
targ_enemy = _loc_1[_loc_2] as enemy;
//trace(distanceFrom(targ_enemy, true));
if (distanceFrom(targ_enemy,true) < range)
{
??//chack target type if not the same stop or if all target typs shot
??if (targ_enemy.type_enemy == target_type ||
??targ_enemy.type_enemy =="both") { }else{break;}
??//SFX.towerShoot.play();
??//create bullet
??//trace("shoot");
??world.add(new bullet(x,y,speed_shoot,dmg,twoer_type,1500,targ_enemy));
??break;
}
_loc_2 = _loc_2 + 1;
}//end while
//reset shoot cooldwom
shot_delay_count = 0;
?}//end count delay
?
?
}//end obtainTarget
[\code]