Comunidad de diseño web y desarrollo en internet online

MI PERSONAJE NO PISA EL SUELO, PISA MAS ARRIBA

Citar            
MensajeEscrito el 10 Nov 2011 11:53 pm
MIREN MI PERSONAJE (NOSEPORQUE) NO PISA EL SUELO.ES DECIR PISA PERO MAS ARRIBA

EL CODIGO DEL PERSONAJE ES

Código ActionScript :

onClipEvent (load) {
xvel = 6;
yvel = 1;
salto = -17;
limite = 10;
}
onClipEvent (enterFrame) {
if (_root.suelo.hitTest(_x, _y+_height/2, true)) {
while (_root.suelo.hitTest(_x, -2+_y+_height/2, true)) {
_y--;
}
yvel = 0;
if (Key.isDown(Key.UP)) {
yvel = salto;
_y += yvel;
}
} else if (_root.suelo.hitTest(_x, _y-_height/2, true)) {
yvel = yvel*-1;
_y += yvel;
while (_root.suelo.hitTest(_x, _y-_height/2, true)) {
_y++;
}
} else {
_y += yvel;
if (yvel<=limite) {
yvel++;
}
}
_x += (Key.isDown(Key.RIGHT)-Key.isDown(Key.LEFT))*xvel;
while (_root.suelo.hitTest(_x+_width/2, _y, true)) {
_x--;
} while (_root.suelo.hitTest(_x-_width/2, _y, true)) {
_x++;
}
} 


espero que puedan ayudarme
SALUDOS

Por El Fantasma J

3 de clabLevel



 

firefox
Citar            
MensajeEscrito el 18 Nov 2011 09:17 pm

Por jhony192

791 de clabLevel

1 tutorial

Genero:Masculino  

Just Another Programmer

firefox
Citar            
MensajeEscrito el 23 Nov 2011 10:11 pm

El Fantasma J escribió:

MIREN MI PERSONAJE (NOSEPORQUE) NO PISA EL SUELO.ES DECIR PISA PERO MAS ARRIBA

EL CODIGO DEL PERSONAJE ES

Código ActionScript :

onClipEvent (load) {
xvel = 6;
yvel = 1;
salto = -17;
limite = 10;
}
onClipEvent (enterFrame) {
if (_root.suelo.hitTest(_x, _y+_height/2, true)) {
while (_root.suelo.hitTest(_x, -2+_y+_height/2, true)) {
_y--;
}
yvel = 0;
if (Key.isDown(Key.UP)) {
yvel = salto;
_y += yvel;
}
} else if (_root.suelo.hitTest(_x, _y-_height/2, true)) {
yvel = yvel*-1;
_y += yvel;
while (_root.suelo.hitTest(_x, _y-_height/2, true)) {
_y++;
}
} else {
_y += yvel;
if (yvel<=limite) {
yvel++;
}
}
_x += (Key.isDown(Key.RIGHT)-Key.isDown(Key.LEFT))*xvel;
while (_root.suelo.hitTest(_x+_width/2, _y, true)) {
_x--;
} while (_root.suelo.hitTest(_x-_width/2, _y, true)) {
_x++;
}
} 


espero que puedan ayudarme
SALUDOS



No se si ya le abran ayudado con su problema pero aqui le dejo un codigo probado por mi saludos

si tampoco le funciona intente organizar el cuerpo de su personaje. saludos

onClipEvent (load) {
xvel = 4;
yvel = 1;
salto = -10;
limite = 10;
}
onClipEvent (enterFrame) {
if (_root.suelo.hitTest(_x, _y+_height/2, true)) {
while (_root.suelo.hitTest(_x, -2+_y+_height/2, true)) {
_y--;
}
yvel = 0;
if (Key.isDown(Key.UP)) {
yvel = salto;
_y += yvel;
}
} else if (_root.suelo.hitTest(_x, _y-_height/2, true)) {
yvel = yvel*-1;
_y += yvel;
while (_root.suelo.hitTest(_x, _y-_height/2, true)) {
_y++;
}
} else {
_y += yvel;
if (yvel<=limite) {
yvel++;
}
}
_x += (Key.isDown(Key.RIGHT)-Key.isDown(Key.LEFT))*xvel;
while (_root.suelo.hitTest(_x+_width/2, _y, true)) {
_x--;
} while (_root.suelo.hitTest(_x-_width/2, _y, true)) {
_x++;
}
}

Por juanichel

4 de clabLevel



 

estudiante

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.