manic said:frame 1 :
stop();
// declare and initialise variables
bombNum = 0;
lives = 3;
score = 0;
speed = 10;
// --------- INITIALISE ALIENS ------------- //
_global.initAliens = function(mc) {
depth = 0;
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
attachMovie(mc, mc+i+"_"+j, 100+depth);
_root[mc+i+"_"+j]._x = j*40;
_root[mc+i+"_"+j]._y = i*40-80;
depth++;
}
}
};
// ------- MOVE ALIENS ----------------- //
_global.moveAliens = function(mc, frame, alspeed) {
// count the dead baddies
_root.deadcount = 0;
// loop through baddies
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
// move horizontal
_root[mc+i+"_"+j]._x += speed;
// check if aliens hit defender
if (_root[mc+i+"_"+j].hitTest(_root.defender)) {
cleanup(mc);
_root.gotoAndStop(1);
}
// check if any aliens left alive
if (_root[mc+i+"_"+j] != null) {
++_root.deadcount;
}
// -------test bullet hit
bulleti = 6;
while (--bulleti>1) {
if (_root[mc+i+"_"+j].hittest(eval("_root.bullet"+bulleti))) {
_root[mc+i+"_"+j].removeMovieClip();
eval("_root.bullet"+bulleti).removeMovieClip();
_root.score += 1;
}
}
// hits left wall
if (_root[mc+i+"_"+j]._x<0) {
// set direction to right
speed = alspeed;
// drop down
dropdown = true;
break;
}
// hit right wall
if (_root[mc+i+"_"+j]._x>Stage.width) {
// set direction to left
speed = -alspeed;
// drop down
dropdown = true;
break;
}
}
}
// drop down all the rows
if (dropdown) {
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
_root[mc+i+"_"+j]._y += 20;
}
}
}
// reset flag
dropdown = false;
// if all aliens are dead
if (_root.deadcount == 0) {
// go to next level
_root.bombspeed = 0.0;
_root.gotoAndStop(frame);
}
};
// ----------- INIT BOMBS --------------- //
_global.initBombs = function(bombspeed) {
// drop bombs
if (Math.random()<bombspeed) {
// duplicate the bomb mc
attachMovie("bomb", "bomb"+bombNum, 200+bombNum);
// set the coords to a random position
eval("_root.bomb"+bombNum)._x = random(700);
eval("_root.bomb"+bombNum)._y = 300*Math.random();
// increment the bomb number
bombNum++;
// if more than 10 bombs , start again at 0
if (bombNum>10) {
bombNum = 0;
}
}
};
// -------------- MOVE BOMBS ---------------- //
_global.moveBombs = function(mc) {
var bombi = 0;
while (bombi<11) {
_root["bomb"+bombi]._y += 5;
// hitest defender
if (_root["bomb"+bombi].hittest(_root.defender)) {
_root["bomb"+bombi].removeMovieClip();
_root.lives -= 1;
// lives are all gone
if (_root.lives<=0) {
// go to start
Mouse.show();
_root.bombspeed = 0.0;
_root.gotoAndStop(1);
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
_root[mc+i+"_"+j]._visible = false;
}
}
break;
}
}
// test if bomb goes offscreen
if (_root["bomb"+bombi]._y>Stage.height) {
_root["bomb"+bombi].removeMovieClip();
}
bombi++;
}
};
// ---------- CLEAN UP -------- //
_global.cleanup = function(mc) {
_root.bombspeed = 0.0;
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
// move horizontal
_root[mc+i+"_"+j]._visible = false;
}
}
};
FRAME 2:
stop();
// initialise variables
bulletNum = 0;
dropdown = false;
speed = 10;
_root.bombspeed = 0.1;
initAliens("zombie");
// ----------- ONLOAD ----------- //
_root.onLoad = function() {
Mouse.hide();
};
// ------------- ENTERFRAME ---------- //
_root.onEnterFrame = function() {
// move the defender with the mouse.
_root.defender._x = _root._xmouse;
_root.defender._y = 385;
// bullet move
var y = 0;
while (y<6) {
eval("_root.bullet"+y)._y -= 30;
y++;
}
moveBombs("zombie");
moveAliens("zombie", 3, 10);
initBombs(_root.bombspeed);
};
// ------------- MOUSE CLICK ---------- //
_root.onMouseDown = function() {
// duplicate the bullet mc
attachMovie("bullet", "bullet"+bulletNum, bulletNum);
// set the coords to the mouse clik
eval("_root.bullet"+bulletNum)._x = _root.defender._x;
eval("_root.bullet"+bulletNum)._y = _root.defender._y;
// increment the bullet number
++bulletNum;
// if more than 5 bullets , start again at 0
if (bulletNum>5) {
bulletNum = 0;
}
};
manic said:rockin could you take that off plz
i visit this at my friends house and he has a look through the threads and if he finds that out well
killers said::shock:
we have received an extraterrestrial message :banana: :banana: :banana: :banana:
manic said:i'm tinkin bout starting tile based games which will mean i'll have to plan wwwwwwwaaaaaayyyyyyyy ahead but end result should be good i think
manic said:frame 1 :
stop();
// declare and initialise variables
bombNum = 0;
lives = 3;
score = 0;
speed = 10;
// --------- INITIALISE ALIENS ------------- //
_global.initAliens = function(mc) {
depth = 0;
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
attachMovie(mc, mc+i+"_"+j, 100+depth);
_root[mc+i+"_"+j]._x = j*40;
_root[mc+i+"_"+j]._y = i*40-80;
depth++;
}
}
};
// ------- MOVE ALIENS ----------------- //
_global.moveAliens = function(mc, frame, alspeed) {
// count the dead baddies
_root.deadcount = 0;
// loop through baddies
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
// move horizontal
_root[mc+i+"_"+j]._x += speed;
// check if aliens hit defender
if (_root[mc+i+"_"+j].hitTest(_root.defender)) {
cleanup(mc);
_root.gotoAndStop(1);
}
// check if any aliens left alive
if (_root[mc+i+"_"+j] != null) {
++_root.deadcount;
}
// -------test bullet hit
bulleti = 6;
while (--bulleti>1) {
if (_root[mc+i+"_"+j].hittest(eval("_root.bullet"+bulleti))) {
_root[mc+i+"_"+j].removeMovieClip();
eval("_root.bullet"+bulleti).removeMovieClip();
_root.score += 1;
}
}
// hits left wall
if (_root[mc+i+"_"+j]._x<0) {
// set direction to right
speed = alspeed;
// drop down
dropdown = true;
break;
}
// hit right wall
if (_root[mc+i+"_"+j]._x>Stage.width) {
// set direction to left
speed = -alspeed;
// drop down
dropdown = true;
break;
}
}
}
// drop down all the rows
if (dropdown) {
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
_root[mc+i+"_"+j]._y += 20;
}
}
}
// reset flag
dropdown = false;
// if all aliens are dead
if (_root.deadcount == 0) {
// go to next level
_root.bombspeed = 0.0;
_root.gotoAndStop(frame);
}
};
// ----------- INIT BOMBS --------------- //
_global.initBombs = function(bombspeed) {
// drop bombs
if (Math.random()<bombspeed) {
// duplicate the bomb mc
attachMovie("bomb", "bomb"+bombNum, 200+bombNum);
// set the coords to a random position
eval("_root.bomb"+bombNum)._x = random(700);
eval("_root.bomb"+bombNum)._y = 300*Math.random();
// increment the bomb number
bombNum++;
// if more than 10 bombs , start again at 0
if (bombNum>10) {
bombNum = 0;
}
}
};
// -------------- MOVE BOMBS ---------------- //
_global.moveBombs = function(mc) {
var bombi = 0;
while (bombi<11) {
_root["bomb"+bombi]._y += 5;
// hitest defender
if (_root["bomb"+bombi].hittest(_root.defender)) {
_root["bomb"+bombi].removeMovieClip();
_root.lives -= 1;
// lives are all gone
if (_root.lives<=0) {
// go to start
Mouse.show();
_root.bombspeed = 0.0;
_root.gotoAndStop(1);
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
_root[mc+i+"_"+j]._visible = false;
}
}
break;
}
}
// test if bomb goes offscreen
if (_root["bomb"+bombi]._y>Stage.height) {
_root["bomb"+bombi].removeMovieClip();
}
bombi++;
}
};
// ---------- CLEAN UP -------- //
_global.cleanup = function(mc) {
_root.bombspeed = 0.0;
for (var i = 0; i<3; i++) {
for (var j = 0; j<10; j++) {
// move horizontal
_root[mc+i+"_"+j]._visible = false;
}
}
};
FRAME 2:
stop();
// initialise variables
bulletNum = 0;
dropdown = false;
speed = 10;
_root.bombspeed = 0.1;
initAliens("zombie");
// ----------- ONLOAD ----------- //
_root.onLoad = function() {
Mouse.hide();
};
// ------------- ENTERFRAME ---------- //
_root.onEnterFrame = function() {
// move the defender with the mouse.
_root.defender._x = _root._xmouse;
_root.defender._y = 385;
// bullet move
var y = 0;
while (y<6) {
eval("_root.bullet"+y)._y -= 30;
y++;
}
moveBombs("zombie");
moveAliens("zombie", 3, 10);
initBombs(_root.bombspeed);
};
// ------------- MOUSE CLICK ---------- //
_root.onMouseDown = function() {
// duplicate the bullet mc
attachMovie("bullet", "bullet"+bulletNum, bulletNum);
// set the coords to the mouse clik
eval("_root.bullet"+bulletNum)._x = _root.defender._x;
eval("_root.bullet"+bulletNum)._y = _root.defender._y;
// increment the bullet number
++bulletNum;
// if more than 5 bullets , start again at 0
if (bulletNum>5) {
bulletNum = 0;
}
};
:shock: shit lemme have another lookMaidenMadness said:still don't understand in this part
bulleti = 6;
while (--bulleti>1) {
if (_root[mc+i+"_"+j].hittest(eval("_root.bullet"+bulleti))) {
_root[mc+i+"_"+j].removeMovieClip();
eval("_root.bullet"+bulleti).removeMovieClip();
_root.score += 1;
}
}
WHERE DO YOU CHECK WHAT ALIEN HAS BEEN HIT, REMEMBER ITS POSITION AND THEN REMOVE IT?
wait bulletiMaidenMadness said:still don't understand in this part
bulleti = 6;
while (--bulleti>1) {
if (_root[mc+i+"_"+j].hittest(eval("_root.bullet"+bulleti))) {
_root[mc+i+"_"+j].removeMovieClip();
eval("_root.bullet"+bulleti).removeMovieClip();
_root.score += 1;
}
}
WHERE DO YOU CHECK WHAT ALIEN HAS BEEN HIT, REMEMBER ITS POSITION AND THEN REMOVE IT?
i don't know flash. i'm judging based on my knowledge of c and visual c++. all i know about flash is that its simpler version of visual c++ but some stuff have been changed. so i am really useless.manic said:oh fackety fack fack
i just changed the script
didn't work
quited and pressed enter now i gotta sort out that dodgy script :x
MM can you give me the right code i want plz..
you'll be in the credits :wink:
then i'm fecking doomed :x i ask ppl on n00b grounds and they say figure it out yourself its the only way you'll learn itMaidenMadness said:i don't know flash. i'm judging based on my knowledge of c and visual c++. all i know about flash is that its simpler version of visual c++ but some stuff have been changed. so i am really useless.
and me?the_nomad said:and credit will be given
each row of ennemies could have a name of the BB's maiden world
the_nomaders
the wickiers
the plumbers
the manics
the MMers
the bockiers
the cyrs
the killers
the SDGers
the twilighters
the ewils
lol just an idea #The#2RY said:and me?
I never said mastered :roll: (or did I?)manic said:lol just an idea #
good to have ya back
according to a PM you have mastered flash
what is the facking code i need