Hello again!
Here’s what I’d like some help with:
- Add multiple enemies.
- When a bullet hits an enemy they should both dissapear.
- A moveable background (stacked in infinity).
…and if it’s not to much to ask - After a while, change enemies that are a bit harder to kill.
Here’s the code now:
var mySound=new Sound();
mySound.setVolume(“20”);
mySound.loadSound(“song.mp3”,true);
_root.score = 0;
chaosCopter_mc.onEnterFrame = function() {
if (Key.isDown(68)) {
this._x += 10;
if (this._x>850) {
this._x = 850;
}
}
if (Key.isDown(65)) {
this._x -= 10;
if (this._x<50) {
this._x = 50;
}
}
if (Key.isDown(87)) {
this._y -= 10;
if (this._y<50) {
this._y = 50;
}
}
if (Key.isDown(83)) {
this._y += 10;
if (this._y>655) {
this._y = 655;
}
}
if (this.hitTest(b1)) {
// chaosCopter_mc._y = 600;
// chaosCopter_mc._x = 500;
_root.score -= 1000;
}
arrowX = this._x;
arrowY = this._y;
if (Key.isDown(Key.ENTER)) {
chaosFire();
} else {
allowFire = 1;
}
}
var i:Number = 1;
function chaosFire() {
if (allowFire == 1) {
i += 1;
var newname = “chaosFire_mc”+i;
_root.attachMovie(“chaosFire_mc”, newname, i);
_root[newname]._y = _root.chaosCopter_mc._y+2;
_root[newname]._x = _root.chaosCopter_mc._x-19;
allowFire = 0;
_root[newname].onEnterFrame = function() {
var bullet_speed = 10;
this._y -= bullet_speed;
if (this._y<0) {
this.removeMovieClip();
} else {
if (this.hitTest(b1)) {
_root.score += 1000;
this.removeMovieClip();
}
}
}
}
}
b1.onEnterFrame = function(){
this._y += 4;
this._x += 1;
if (this._y > 850){
this._y = -15;
this._x = random(800);
}else{
if (this._x > 1100){
this._y = -15;
this._x = random(800);
}else{
if (this.hitTest(chaosCopter_mc)) {
}
}
}
}
As you can see, only one enemy. The bullets dissapear when they hit the enemy and 1000 points are added to a dynamic textfield. If the enemy hits the chaosCopter there’s a 1000 point reduction.
Thanks in advance
//Henrik