I recently purchased Flash CS3 and I was surprised to see that when I initially compiled my movie, none of the actions worked - in fact, several errors occurred.
I then realized I was compiling under AS3.0 document setting and compiler 9.0
My question is, I know this is “dirty” of me to ask such a favor, but this is the only way I really can learn… Is it possible for anyone to do even at least a pseudo conversion of my original AS2.0 code, let alone a full conversion?
radHitTest = function(obj1,obj2,rad) {
if ((Math.sqrt(Math.pow(obj1._x-obj2._x,2)+Math.pow(obj1._y-obj2._y,2)))<
((obj1._width+rad)/2 + obj2._width/2))
return true;
else
return false
}
circleHitTest = function(obj1,obj2) {
if ((Math.sqrt(Math.pow(obj1._x-obj2._x,2)+Math.pow(obj1._y-obj2._y,2)))<
(obj1._width/2 + obj2._width/2))
return true;
else
return false
}
createZergling = function () {
var unit = _root.attachMovie("zergling", "zergling", _root.getNextHighestDepth());
unit._x = random(320);
unit._y = random(190);
unit.fhp = 40;
unit.hp = 40;
unit.atk = 5;
unit.def = 0;
unit.atkb = 0;
unit.regen = 0
unit.spd = 2.5;
unit.attacking = false;
unit.alive = true;
unit.onEnterFrame = function() {
if (this._x < 5){this._x += this.spd;}
if (this._y < 10){this._y += this.spd;}
if (this._x > 315){this._x -= this.spd;}
if (this._y > 190){this._y -= this.spd;}
if (_root.marine.alive == false)
this.spd = 0;
_root.enemy = unit
if (this.hp < this.fhp){
this.regen += 1;
if (this.regen > 30){
this.hp++
this.regen = 0;
}
}
if (this.hp < 1) {this.meter.bar._width = 0}
this.meter.bar._width = (this.hp/this.fhp)*20
if (this.attacking && this.whole.attack._currentframe == 6){
_root.marine.hp -= this.atk - _root.marine.def + this.atkb;
_root.blood.gotoAndPlay(2);
}
myRadians = Math.atan2(_root.marine._y-this._y, _root.marine._x-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
if (this.alive){
this._x += Math.cos(myRadians) * this.spd;
this._y += Math.sin(myRadians) * this.spd;
}
if(circleHitTest(_root.marine,this) && this.alive&& _root.marine.alive) {
this.whole.gotoAndStop(2);
this.attacking = true;
this.spd = 0;
}else if(circleHitTest(_root.marine,this) && this.alive&& _root.marine.alive == false) {
this.whole.gotoAndStop(1);
this.spd= 2;
} else {
if (this.alive){
this.whole.gotoAndStop(1);
this.attacking = false;
this.spd = 2
this.whole._rotation = myDegrees+90;
}
}
if (this.whole.death._currentframe == 40){
this.removeMovieClip();
createZealot();
_root.marine.stat += 50;
}
if (this.hp < 0){
this.whole.gotoAndStop(3);
this.alive = false;
}
};
};
Thanks.
Or… even the most basic help would be the conversion of the cicleHittest