Foros del Web » Creando para Internet » Flash y Actionscript »

volver al principio (juego flash)

Estas en el tema de volver al principio (juego flash) en el foro de Flash y Actionscript en Foros del Web. Buenas! Después de haber hecho animaciones y webs, estoy tratando de crear mi primer juego en flash. Es el típico juego donde una bolita tiene ...
  #1 (permalink)  
Antiguo 08/08/2009, 11:14
 
Fecha de Ingreso: agosto-2009
Mensajes: 1
Antigüedad: 14 años, 8 meses
Puntos: 0
volver al principio (juego flash)

Buenas! Después de haber hecho animaciones y webs, estoy tratando de crear mi primer juego en flash. Es el típico juego donde una bolita tiene que seguir un camino sin tocar los laterales del mismo.

Mi pregunta es: como puedo hacer para que cuando la "bolita" toque un lateral, automaticamente vuelva a la posición inicial, osea al principio del circuito.

Supongo que se hará tambien con el hittest pero no averiguo como. El código hasta ahora va así:

onEnterFrame = function() {
var velocidad:Number = 7;

if (Key.isDown(Key.DOWN)) {
if (!(fondo.hitTest(bolita.getBounds(_root).xMin, bolita.getBounds(_root).yMax+velocidad, true) || fondo.hitTest(bolita.getBounds(_root).xMax, bolita.getBounds(_root).yMax+velocidad, true))) {
bolita._y += velocidad;
}
}
if (Key.isDown(Key.UP)) {
if (!(fondo.hitTest(bolita.getBounds(_root).xMin, bolita.getBounds(_root).yMin-velocidad, true) || fondo.hitTest(bolita.getBounds(_root).xMax, bolita.getBounds(_root).yMin-velocidad, true))) {
bolita._y -= velocidad;
}
}
if (Key.isDown(Key.LEFT)) {
if (!(fondo.hitTest(bolita.getBounds(_root).xMin-velocidad, bolita.getBounds(_root).yMin, true) || fondo.hitTest(bolita.getBounds(_root).xMin-velocidad, bolita.getBounds(_root).yMax, true))) {
bolita._x -= velocidad;
}
}
if (Key.isDown(Key.RIGHT)) {
if (!(fondo.hitTest(bolita.getBounds(_root).xMax+velo cidad, bolita.getBounds(_root).yMin, true) || fondo.hitTest(bolita.getBounds(_root).xMax+velocid ad, bolita.getBounds(_root).yMax, true))) {
bolita._x += velocidad;
}
}
}



Alguien puede decirme cual sería el actionscript, o alguna solución.
Gracias!
  #2 (permalink)  
Antiguo 08/08/2009, 18:04
kpx
 
Fecha de Ingreso: julio-2009
Mensajes: 13
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: volver al principio (juego flash)

lo q puedes hacer es hacer un trace de bolita._x y bolita._y

das preview... y sin mover la bolita anotas los numeros q te salen en el output...

(o simplremente con la pestala de info... ves las cordenadas en x,y de bolita..

cuando tengas estos numeros solo es q hagas la condicional igual con el hitTest..



Cita:
if (bolita.hitTest(lateral)){
bolita._x = (cordenada x)
bolita._y = (cordenada y)
}
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:46.