en este momento estoy diseñando y programando un juego en flash...
actions script 2 y flash 8... en fin
Tengo un problema..... el juego siempre se mueve hacia la derecha.... como el movimiento de escenario de mario bros...
De hecho imaginemos que estamos en mario bros... cuando uno dispara el disparo obviamente sale hacia el lado el cual uno este mirando... esto lo tengo bien programado... el problema es cuando el jugador se voltea hacia la izquierda el disparo sale hacia la direccion contraria osea la derecha....
como puedo arreglar esto....
para los que quieran invulocrarse en el tema... lo cual agradeceria mucho les doy la siguiente informacion
LASER
Código :
onClipEvent (load) {
laserMoveSpeed = 20;
this._x = _root.mira_mc._x+35;
this._y = _root.mira_mc._y+30;
//scorc = _root.scora+_root.scorb;
}
onClipEvent (enterFrame) {
if (this._name<>"laser") {
this._x += laserMoveSpeed;
if (this._x>800) {
_root.mira_mc.laserCounter--;
this.removeMovieClip();
} else if ((this._name<>"laser") and (_xscale == -scale)) {
this._x -= laserMoveSpeed;
if (this._x<-5) {
_root.mira_mc.laserCounter--;
this.removeMovieClip();
}
}
for (i=1; i<=_root.numEnemy; i++) {
if (this.hitTest(_root["enemy"+i])) {
_root.scora += 13;
_root.scorc += 13;
this._visible = false;
_root["enemy"+i].gotoAndPlay(2);
this.play();
} else if (this.hitTest(_root["enemy2"+i])) {
_root.scorb += 7;
_root.scorc += 7;
this._visible = false;
_root["enemy2"+i].gotoAndPlay(2);
this.play();
}
if (_root.scorc>3000) {
_root.gotoAndStop("puntaje", 1);
}
}
}
}
PERSONAJE PRINCIPAL
Código :
onClipEvent (load) {
moveSpeed = 3;
_root.laser._visible = false;
laserCounter = 1;
scrollx = 470;
scrollStart = false;
maxLasers = 3;
depthCounter = 1;
scale = _xscale;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE) and (laserCounter<=maxLasers)) {
laserCounter++;
_root.laser.duplicateMovieClip("laser"+depthCounter, depthCounter);
_root["laser"+depthCounter]._visible = true;
depthCounter++;
if (depthCounter>maxLasers) {
depthCounter = 1;
}
this.dispara_mc.play();
}
if (Key.isDown(Key.RIGHT)) {
this._xscale = +scale;
this.camina_mc.play();
if (this._x<scrollx) {
this._x += moveSpeed;
} else {
scrollStart = true;
}
} else if (Key.isDown(Key.LEFT) && !_root.leftbound.hitTest(_x, _y, true)) {
this._x -= moveSpeed;
scrollStart = false;
this.camina_mc.play();
this._xscale = -scale;
}
if (Key.isDown(Key.DOWN) && !_root.downbound.hitTest(_x, _y, true)) {
this._y += moveSpeed;
this.camina_mc.play();
} else if (Key.isDown(Key.UP) && !_root.upbound.hitTest(_x, _y, true)) {
this._y -= moveSpeed;
this.camina_mc.play();
}
if (Key.isDown(Key.ENTER)) {
getURL("http://www.nyse.com", "_blank");
}
}
onClipEvent (keyUp) {
if (Key.getCode() == (Key.RIGHT)) {
scrollStart = false;
}
}
ENEMIGO 1la programacion del enemigo2 osea el ke proviene de la izquierda la omito... seria simple el cambio de direccion.. ademas llenaria mas texto....
Código :
onClipEvent (load) {
function reset() {
this._x = 850;
this._y = random(100)+370;
enemySpeed = random(4)+1;
this.gotoAndStop(1);
}
reset();
}
onClipEvent (enterFrame) {
if (_root.mira_mc.scrollStart) {
this._x -= enemySpeed+_root.mainGround.groundSpeed;
} else {
this._x -= enemySpeed;
}
if (this._x<-10) {
reset();
}
if (this.hitTest(_root.mira_mc)) {
_root.gotoAndStop("perdiste");
_root.mira_mc.play();
}
}
