LECCION 07
LOS PANELES DE FLASH
PRACTICA: Rotar un objeto en Flash
PRACTICA: Caminante
PRACTICA: Pacman
PRACTICA: Auto de carrera
PRACTICA: Trabajando con imagenes y movimiento clásico.
PRACTICA : Juego de plataforma con niveles en AS 2.0
codigos del personaje:
onClipEvent (load) {
xvel = 6;
yvel = 0;
salto = -8;
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 (yvelAAAAAAAAAAAA=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++;
}
}
onClipEvent (enterFrame) {
if(Key.isDown(Key.LEFT)){
this._xscale = -100
}else
if(Key.isDown(Key.RIGHT)){
this._xscale = 100
}
}
Codigos de "siguiente"
onClipEvent (load) {
xvel = 6;
yvel = 0;
salto = -8;
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 (yvelAAAAAAAAAAAA=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++;
}
}
onClipEvent (enterFrame) {
if(Key.isDown(Key.LEFT)){
this._xscale = -100
}else
if(Key.isDown(Key.RIGHT)){
this._xscale = 100
}
}
Codigos de "siguiente"
onClipEvent(enterFrame){
if(this.hitTest(_root.personaje)){
_root.nextFrame();
}
}
VIDEO PARA MEJORAR EL ESCENARIO
VIDEO PARA DIBUJAR EL PERSONAJE
PRACTICA : Juego de plataforma de naves en AS 2.0
Codigo AS2:
En Fotograma:
if(this.nave.hitTest(this.roca)){
cuantos=Number(cuantos) + 1
this.roca.gotoAndPlay(1);
}
if(cuantos aqui signi mayor que 9) {
this.gotoAndStop(10);
}else{
this.gotoAndPlay(1);
}
En Nave:
En Fotograma:
if(this.nave.hitTest(this.roca)){
cuantos=Number(cuantos) + 1
this.roca.gotoAndPlay(1);
}
if(cuantos aqui signi mayor que 9) {
this.gotoAndStop(10);
}else{
this.gotoAndPlay(1);
}
En Nave:
on (press) {
this.startDrag()
}
on (release) {
this.stopDrag()
}
En Boton Volver a Jugar:
on (release) {
this.gotoAndPlay(1);
cuantos=0
}
En Roca:
this._y=Math.random() * 300







No hay comentarios:
Publicar un comentario