PDA

View Full Version : Lots of problems


dcwoody
03-31-2005, 08:18 PM
Right apparently I wasn't very clear.
I have several problems with a game I am making using flash 5
1st
The game is two player, each player has a ship (or in this case blob) and the aim is to shoot the opposing ship/blob.
One of the blobs works fine. the other blob doesn't, it moves fine, when its lazers hit the other blob they destroy it, it can be destoryed fine BUT the lazers it fires appear at seemingly random places, they are at the right x coordinate but the Y is screwy.
I have used the same script for both ships and I do not understand why one ship works and the other doesn't.
I think I will leave the other problems for now.

This is the script for the ship that works fine: (called Leftboard)

onClipEvent(load){
moveSpeed=1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
LeftfireCounter++;
_root.Leftfire.duplicateMovieClip( "Leftfire"+LeftfireCounter, LeftfireCounter);
_root["Leftfire"+LeftfireCounter]._visible=true;
}

if (Key.isDown(Key.CONTROL)) {
this._y+=moveSpeed;
} else if (Key.isDown(Key.SHIFT)) {
this._y-=moveSpeed;
}
{
if (this.hitTest( _root["bottom"])){
_root.score+=100;
_root["Leftboard"].gotoAndPlay( 2 );
this._y=_root.Board._y;
this._x=_root.Board._x-500;
}
{
if (this.hitTest( _root["top"])){
_root.score+=100;
_root["Leftboard"].gotoAndPlay( 2 );
this._y=_root.Board._y;
this._x=_root.Board._x-500;
}
}}
}
This is the script for the lazers it fires which also work fine: (called Leftfire)

onClipEvent(load){
moveSpeed=2;
_root.Leftfire._visible=false;
LeftfireCounter=1;
moveSpeed=10;
_root.Leftfire._visible=false;
LeftfireCounter=1;
}
onClipEvent (load) {
LeftfireMoveSpeed=20;
this._y=_root.Leftboard._y;
this._x=_root.Leftboard._x+19;
}
onClipEvent (enterFrame) {
if (this._name<>"Leftfire"){
this._x+=LeftfireMoveSpeed;
if (this._x>600){
this.removeMovieClip();
}
{
if (this.hitTest( _root["Board"])){
_root.score+=100;
_root["Board"].gotoAndPlay( 2 );
}
}}
}
This is the script for the other ship which seems to work fine appart from shooting: (called Board)
onClipEvent(load){
moveSpeed=1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
FireCounter++;
_root.Fire.duplicateMovieClip( "Fire"+FireCounter, FireCounter);
_root["Fire"+FireCounter]._visible=true;
}

if (Key.isDown(Key.DOWN)) {
this._y+=moveSpeed;
} else if (Key.isDown(Key.UP)) {
this._y-=moveSpeed;
}
{
if (this.hitTest( _root["bottom"])){
_root.score+=100;
_root["Board"].gotoAndPlay( 2 );
this._y=_root.Leftboard._y;
this._x=_root.Leftboard._x+500;
}
{
if (this.hitTest( _root["top"])){
_root.score+=100;
_root["Board"].gotoAndPlay( 2 );
this._y=_root.Leftboard._y;
this._x=_root.Leftboard._x+500;
}
}}
}
And this is the script for the lazers it fires which come out in the wrong place:(called Fire)

onClipEvent(load){
moveSpeed=2;
_root.Fire._visible=false;
FireCounter=1;
moveSpeed=10;
_root.Fire._visible=false;
FireCounter=1;
}
onClipEvent (load) {
FireMoveSpeed=20;
this._y=_root.Board._y;
this._x=_root.Board._x-22;
}
onClipEvent (enterFrame) {
if (this._name<>"Fire"){
this._x-=FireMoveSpeed;
if (this._x<000){
this.removeMovieClip();
}
{
if (this.hitTest( _root["Leftboard"])){
_root.score+=100;
_root["Leftboard"].gotoAndPlay( 2 );
}
}}
}
Could somebody tell me what is wrong with the second ships/secondshipslazers script becasue as far as I can tell its identical to the first ships.

Barn
04-02-2005, 01:02 AM
It would be easier to read if you would edit your original post and include the [ as ] tags around it.

dcwoody
04-12-2005, 07:01 PM
Barn thanks for trying to help but I have no idea what that means...