Comunidad de diseño web y desarrollo en internet online

Juego de Mesa

Citar            
MensajeEscrito el 27 Feb 2010 11:32 pm
Hola estoy haciendo un juego sencillo de billar y quisiera que conseguir que al momento de golpear la pelota con el palo
ésta se mueva a cualquier angulo..!
no se como conseguirlo alguien me podria ayudar..!?
la bola solo se mueve a una direccion y dandole doble click al palo, lo hice con macrome flah 8..!

Código ActionScript :

import mx.transitions.Tween;
import mx.transitions.easing.*;

var stickStart:Number = stick._x-200;
var stickStop:Number = stick._x + 200;

//Posicion del Palo: se mantiene cerca a la bola
stick._x = ball._x+203;
stick._y = ball._y+4;

ball.onPress = function() {
   this.startDrag(false, 12, 20, 490,362);
};

ball.onRelease = function() {

this.stopDrag();
}

stick.onPress = function() {
   this.startDrag(false, 180, 380, 690,10);
};

//Se mueve el palo simulando el golpe de atras hacia adelante
stick.onRelease = function() {

this.stopDrag();

if(stick._x<=ball._x+203 and stick._x>=ball._x+169 and stick._y<=ball._y+20 and stick._y>=ball._y-12){
stick.gotoAndPlay(2);

}
   
   

};

   
   function go_ball() {

      //La bola se empieza a mover: se empieza a  mover cuando termina el movimiento del palo
      if(ball._x>12){
      var tween_ball:Tween = new Tween(ball, "_x", Regular.easeOut, ball._x, ball._x-60, 0.6, true);
      }
      

      tween_ball.onMotionFinished = function() {

         var tween_palox:Tween = new Tween(stick, "_x", Regular.easeOut, stick._x, ball._x+203, 0.7, true);
         var tween_paloy:Tween = new Tween(stick, "_y", Regular.easeOut, stick._y, ball._y+4, 0.7, true);
      };

   }

Por Estfa

0 de clabLevel



 

firefox
Citar            
MensajeEscrito el 01 Mar 2010 06:15 pm
A vuelo de pájaro veo que solo tienes un Tween en X, cuando para simular un movimiento deberías usar trigonometría para calcular los ángulos y al menos una variable de velocidad y otra de fricción para la aceleración. Hay juegos de billar por allí, no recuerdo si con código, pero busca a ver si te sirve de idea

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

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