PDA

View Full Version : defender-like game?



blackdeath
May 4th, 2005, 07:50 PM
Does anyone know anywhere that has tutorials on how to make a "space invaders-esque" game? I've seen tons of tutorials for platforms and rpgs, but none for this style. Any ideas?

nathan99
May 6th, 2005, 10:49 AM
wats a "defender-esque" game? i may be able to help....or i may not

blackdeath
May 6th, 2005, 02:04 PM
wats a "defender-esque" game? i may be able to help....or i may not
I've ment to say "space invaders" all along, I just never realized I had made this post saying "defender" until now :P. You have a cannon/gun-type icon on the bottom of the screen that you can move left and right and you have to shoot aliens that fall from the sky in an uniformed fashion before they reach the bottom, killing you and/or the village/cities you are trying to protect.

http://www.spaceinvaders.de/ has a lot of info on it. Any ideas would be greatly appriciated. Thanks for your reply!

nathan99
May 6th, 2005, 09:27 PM
something like this?

if so ill send it to ya.

blackdeath
May 6th, 2005, 09:31 PM
something like this?

if so ill send it to ya.

yes, like that! :D please send if you could! thanks a lot!

nathan99
May 6th, 2005, 09:37 PM
its MX04, if u need mx ill post, or if u neeed meore help... but ihave never done shooting before so ull hav to post about that

blackdeath
May 6th, 2005, 09:39 PM
its MX04, if u need mx ill post, or if u neeed meore help... but ihave never done shooting before so ull hav to post about that

thanks man! you're my hero! :D

nathan99
May 7th, 2005, 01:12 AM
i told ya i could probably help:D

nathan99
May 7th, 2005, 01:52 AM
bit more adavanced post if u want fla

blackdeath
May 7th, 2005, 06:04 AM
bit more adavanced post if u want fla

sure! Is there anyway to quickly explain how you accomplished this as well?

nathan99
May 7th, 2005, 11:14 AM
OK, i did it a very basic way.

First up,
I put this code in on the frame;


_root.ball.onMouseMove = function() {
_root.ball._x = _xmouse;
Mouse.hide();
updateAfterEvent();
};
_root.lives=3; //score "lives" = 3
_root.hit = 0; //variable "hit" = 0


ball is referring to the player, which i have given the instance name, ball.
Mouse.hide(); tells the stage to hide the mouse.
_root.ball._x = _xmouse; sets the X position of the player to the same as the mouse.


I put this code in on the top row of enemies;


onClipEvent (load) {
xspd = 3;
}
onClipEvent (enterFrame) {
this._x += xspd;
if (this.hitTest(_root.wallrt)) {
xspd *= -1;
this._y += 25;
}
this._x += xspd;
if (this.hitTest(_root.walllft)) {
xspd *= -1;
this._y += 25;
}
if (this.hitTest(_root.bottom) && _root.hit == 0) {
_root.hit = 1;
}
}

xspd = 3; sets the x speed to 3
xspd *= -1;
this._y += 25; ///tells it to multiply the current speed by -1 and move the charcter down 25 px
}


I put this code in on the botton row of enemies;


onClipEvent (load) {
xspd = -3;
}
onClipEvent (enterFrame) {
this._x += xspd;
if (this.hitTest(_root.wallrt)) {
xspd *= -1;
this._y += 25;
}
this._x += xspd;
if (this.hitTest(_root.walllft)) {
xspd *= -1;
this._y += 25;
}
if (this.hitTest(_root.bottom) && _root.hit == 0) {
_root.hit = 1;
}
}


xspd = -3; sets the x speed to 3
xspd *= -1;
this._y += 25; ///tells it to multiply the current speed by -1 and move the charcter down 25 px
}

walllft a wall i have put in which gives the enemies intruction on collision (hitTest)
wallrt another wall i have put in which gives the enemies intruction on collision (hitTest)







now i put in a movie clip (MC) with 20 key frames, which is a square. On frame 20 i made the width to 0, and inserted a shape tween on the whole mc.

on the mc i put;

onClipEvent (enterFrame) {
if (_root.hit == 1) { //if hit equals 1 play this movie clip
play();
}
}

then frame 1 of the mc i put;


stop();


frame 20 of the mc i put;


_root.hit=0; //hit = 0
_root.lives -= 1; //lives take 1



then for the lives, i made a movie clip with 4 keyframes, one with 3 scaled down images of the player, one with 2 scaled down images of the player, one with 1 scaled down image of the player, one no images

on each key frame i put

stop();

and then on the acutal movie clip i put

onClipEvent (enterFrame) {
if (_root.lives == 3) { //if lives equals 3 go to and stop frame 1
this.gotoAndStop(1);
} else if (_root.lives == 2) { //if lives equals 2 go to and stop frame 2
this.gotoAndStop(2);
} else if (_root.lives == 1) { //if lives equals 1 go to and stop frame 3
this.gotoAndStop(3);
} else if (_root.lives == 0) { //if lives equals 0 go to and stop frame 4
this.gotoAndStop(4);
}
}



i dont know if i missed anything but heres the new fla