Jump to content
Search Community

pdiddles03

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by pdiddles03

  1. if I am tweening a object in a game i am  making, i need it's velocity. Is there a way to throw this property so i can use it?  

     

    So lets say i want to jump .

    TweenMax.to(player, 1, {y:player.y-100})
    

    is there any possible way to get the  distance that was traveled from one spot to another? Another way i can explain it is if i push the right or left arrow, i change the x velocity of the object to "player.vx = 5",  so it's velocity is 5.  

  2. I did seem to solve the issue by doing this but I don't feel this is a very convenient way of doing it. Seeing I am writing a game, it adds unnecessary bloat to it.

    if(ship.active_bullets.length > 0){
            for(var i = 0; i < ship.active_bullets.length; i++){
              if(ship.active_bullets[i]){
    
                if(TweenMax.isTweening(ship.active_bullets[i])===false){
                  (function(i){
                    TweenMax.to(ship.active_bullets[i], 2*scale, {y:0,ease:Power0.easeNone,onComplete:function(){
                      
                    }});
                  })(i)
    
                }
              }
            }
          }
    
    
  3. I'm working on a game. Inside of it, i have an array which gets loop through using a for loop and if each object is not being tweened, it tweens them to a specific position like this:

    if(ship.active_bullets.length > 0){
            for(var i = 0; i < ship.active_bullets.length; i++){
              if(ship.active_bullets[i]){
                if(TweenMax.isTweening(ship.active_bullets[i])===false){
                  TweenMax.to(ship.active_bullets[i], 2*scale, {y:0,ease:Power0.easeNone,onComplete:function(){
                    console.log(i)
                    
                  }});
                }
              }
            }
          }
    

    The output in the console on complete is then number 1 instead of 0 which is what it is before the tween. why is this?

×
×
  • Create New...