1..cual seria el codigo para que estos mc(los luchadores) no se atraviesen uno encima de otro , si no que se detengan o choquen?(y con eso me saldria el scrolling background)
2..alguien sabe que codigo estaria bien para que los mc no salgan del area de la pantalla???(asi me ahorro el scrolling)
aqui esta el codigo del mc principal (ionke) , el otro player es: enemy, ojala pueden ayudarme asi acabo esto y a ver si publico un tutorial en castellano de como hacer un juego de pelea.
Código :
onClipEvent(load)
{
var fight=false;
}
onClipEvent(enterFrame)
{
if(fight==false){
//codes for movement
if(Key.isDown(Key.RIGHT))
{
_x+=10;
_xscale=70;
}
if(Key.isDown(Key.LEFT))
{
_x-=10;
_xscale=-70;
}
}
//codes for actions
if(Key.isDown(65)){
gotoAndStop(2); //punch frame
fight=true;
}
else
if(Key.isDown(83)){
gotoAndStop(3); //punch2 frame
fight=true;
}
else
if(Key.isDown(90)){
gotoAndStop(4); //kick frame
fight=true;
}
else
if(Key.isDown(88)){
gotoAndStop(5); //kick2 frame
fight=true;
}
else
if(Key.isDown(38)){
gotoAndStop(6); //salto
fight=true;
}
else
if(Key.isDown(32)){
gotoAndStop(7); //abuke
fight=true;
}
else
if(Key.isDown(40)){
gotoAndStop(8); //agache
fight=true;
}
else
if(Key.isDown(67)){
gotoAndStop(9); //patbaja
fight=true;
}
else
if(Key.isDown(70)){
gotoAndStop(10); //combopios
fight=true;
}
if (_root.enemy.hitTest(_root.ionke.pun1_ion.hityonke)) {
tellTarget ("_parent.enemy") {
gotoAndPlay(2);
_x += 1; }
}
if (_root.enemy.hitTest(_root.ionke.pun2_ion.hityonke)) {
tellTarget ("_parent.enemy") {
gotoAndPlay(2);
_x += 1; }
}
if (_root.enemy.hitTest(_root.ionke.pat1_ion.hityonke)) {
tellTarget ("_parent.enemy") {
gotoAndPlay(2);
_x += 1; }
}
if (_root.enemy.hitTest(_root.ionke.pat2_ion.hityonke)) {
tellTarget ("_parent.enemy") {
gotoAndPlay(2);
_x += 1; }
}
if (_root.enemy.hitTest(_root.ionke.ray_ion.hityonke)) {
tellTarget ("_parent.enemy") {
gotoAndPlay(2);
_x += 1; }
}
if (_root.enemy.hitTest(_root.ionke.p_abajo.hityonke)) {
tellTarget ("_parent.enemy") {
gotoAndPlay(2);
_x += 1; }
}
if (_root.enemy.hitTest(_root.ionke.combo_pios.hityonke)) {
tellTarget ("_parent.enemy") {
gotoAndPlay(2);
_x += 1; }
}
if (_root.wall.hitTest(_root.ionke)) {
tellTarget ("_parent.ground") {
gotoAndPlay(1);
_x -= 1; }
}
if (_root.wall2.hitTest(_root.ionke)) {
tellTarget ("_parent.ground") {
gotoAndPlay(1);
_x += 1; }
}
else fight=false;
}
