View Full Version : need help in making game
NadePalm
May 2nd, 2006, 02:49 AM
yeah dont know why i said i would make a game for my little brother, but i am. he wants a game similar to that of geometry wars on the 360. so im thinking............Vector Wars.
yeah anyway, i need help. i have a very choppy code atm, it runs alright, drops quite a few frames, but there arnt things like hit detection and things like that, its just movement and main character shooting. for some reason i thought it was going to be easy, call me insane.
ok well ill attach the files, if anyone has time to spare to help create this game, i would much appreciate it.
lone_wild_wolf
May 2nd, 2006, 06:46 AM
I can help if you tell me what u want
KIERIOSHIMOTO
May 2nd, 2006, 08:01 AM
what exactly do you need help with?
nathan99
May 2nd, 2006, 08:24 AM
try using
Mouse.hide();
var depth:Number =100;
var extDist:Number = 10;
var bulletSpeed:Number = 20;
var score:Number = 1;
var enemySpeed:Number = 1.5;
var enemyHealth:Number = 50;
spaceShip.speed = 8;
spaceShip.onEnterFrame=function () {
var myRadians:Number = Math.atan2(crossHair._y-this._y, crossHair._x-this._x);
if (Key.isDown(Key.UP)) {
this._x += Math.cos((this._rotation-90)*Math.PI/180)*this.speed;
this._y += Math.sin((this._rotation-90)*Math.PI/180)*this.speed;
}
this._rotation += 6*(Key.isDown(Key.RIGHT)-Key.isDown(Key.LEFT));
crossHair._x = _xmouse;
crossHair._y = _ymouse;
}, onMouseDown=function () {
onEnterFrame = function () {
_root.attachMovie("bullet", "bullet"+depth, depth++, {cacheAsBitmap:true, _x:spaceShip._x, _y:spaceShip._y, _rotation:Math.atan2(crossHair._y-spaceShip._y, crossHair._x-spaceShip._x)*180/Math.PI, onEnterFrame:function () {
this._x += Math.cos(this._rotation*Math.PI/180)*bulletSpeed;
this._y += Math.sin(this._rotation*Math.PI/180)*bulletSpeed;
this._x>Stage.width+extDist || this._x<-extDist ? removeMovieClip(this) : this._y<-extDist || this._y>Stage.height+extDist ? removeMovieClip(this) : null;
}});
depth>=200 ? depth=100 : null;
};
}, onMouseUp=function () {
delete onEnterFrame;
}, createEnemies=function (total) {
for (i=0; i<total; i++) {
attachMovie("enemy", "enemy"+i, i, {health:enemyHealth, cacheAsBitmap:true, spreadValue:Math.round(Math.random()*1), spreadTarget:spread[spreadValue], _x:Math.random()*Stage.width, _y:Math.random()*Stage.height, onEnterFrame:function () {
var deg:Number = Math.atan2(spaceShip._y-this._y, spaceShip._x-this._x)*180/Math.PI;
this._rotation = deg+90;
this._x += Math.cos(deg*Math.PI/180)*enemySpeed;
this._y += Math.sin(deg*Math.PI/180)*enemySpeed;
for (var scan:Number = 100; scan<200; scan++) {
this.hitTest(_root["bullet"+scan]) ? killUnit(this) : null;
}
}});
}
};
killUnit = function (target) {
target.removeMovieClip()
trace("Score = "+score++);
};
createEnemies(5);
instead... it's a bit shorter
NadePalm
May 2nd, 2006, 10:16 AM
wow thanks for the replies. sorry i didnt say exactly what i needed. cheers for the code. i guess what i need are code optimisations, because if you have seen or play Geometry Wars, theres alot happening on the screen at once, i know flash wont be able to push its limits to the extremes of geometry wars, but id like to get it close. also i have no idea how to create a class, well i guess the main thing is, i dont know what the advantages are of using classes.
InfestedDemon
May 2nd, 2006, 04:47 PM
can i see the .swf? *The updated one*. Too see what youve done.
nathan99
May 2nd, 2006, 06:32 PM
flash + CPU = McDonalds + a fat guy. IOW, Flash likes to eat a lot, quickly.
NadePalm
May 3rd, 2006, 03:36 AM
yeah i think i might have to learn java. from what ive seen, its kind of similar to actionscript. anyway, yeah heres the updated swf
nathan99
May 3rd, 2006, 06:28 AM
thats a lot better, bit too fast
InfestedDemon
May 3rd, 2006, 03:23 PM
there is one thing you could change. Where the bullet is comming out, try to place the coridnates at the tip of the ship to make it more realistic. :mu:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.