Jump to content


  • Posts

  • Joined

  • Last visited

jdrumm's Achievements



  1. Thanks for the assist. I was close, I was using: x:spawnPoint_Array[randomize], y:spawnPoint_Array[randomize] instead of: x.spawnPoint_Array[randomize].x, y:spawnPoint_Array[randomize].y all I needed was the .y and .x on the end of the random call, Wow, I feel foolish. Thanks for the answer. YOU GUYS AT GREENSOCK ARE THE BEST, LOVE YOUR WORK. "YOUR THE BEST AROUND, NO ONE'S GONNA EVER KEEP YA DOWN!"
  2. y:spawnPoint_Array[random].y} y:spawnPoint_Array[random].y}
  3. I'm trying to create a system of spawns for an as3 game. The goal is to have my enemy tweens spawn from one of the 4 different spawn points defined in the array of new Points, randomly. I've successful debugged my process so far, as the code at the very bottom illustrates. However, the problem comes when I attempt to enter my random spawn call into the starting point of the greensock tween. The code below shows if the random spawn call starts at the x value, that is to say: {startAt:{x:myArray[random]}, the problem here is that when myArray[random] is called in that manner it's going to return both an x and a y value which of course is not going to work b/c both points are put into the x value of the tween, and separating the x and y values into two different arrays will call random x and y values, voiding my original intent of them spawning from a static point randomly. That being said, I'm asking if there is a way that I could combine both an x and y value in one place so, in theory the tween I'm looking for might look like this: myTween = TweenMax.to(mc, 3, {startAt:{myArray[random]}, x:end.x, y:end.y}); *notice how I want the starting point to be the randomly picked point in the array. * here is the idea put into action, but notice starting point below is { x:myArray[random] } var spawnPoint_Array:Array = [new Point(270, 808), //////// X and Y value of SPAWN 1 new Point(-81, 768), //////// X and Y value of SPAWN 2 new Point(1024, 768), //////// X and Y value of SPAWN 3 new Point(566, 809)] //////// X and Y value of SPAWN 4 var random = Math.round(spawnPoint_Array.length * Math.random()); //////picks a random spawn point myTween = TweenMax.to(mc, 3, {startAt:{x:myArray[random]}, x:end.x, y:end.y}); *in the above tween, mc just refers to the movieclip name Any ideas on how I would fix this problem?