Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/08/2009, 11:14
Josh7
 
Fecha de Ingreso: agosto-2009
Mensajes: 1
Antigüedad: 14 años, 9 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!