Game Development Reference
In-Depth Information
theBird.x=slingX+slingR*Math.cos(birdAngle);
theBird.y=slingY+slingR*Math.sin(birdAngle);
}
}
The only thing that really matters in our physics world is the position from which
the player releases the bird. According to the bird position and the sling center,
we can determine how to fire the bird.
So the birdRelease function at the moment will just print the coordinates of the
just released bird on the output window.
private function birdRelease(e:MouseEvent):void {
trace("bird released at "+theBird.x+","+theBird.y);
stage.removeEventListener(MouseEvent.MOUSE_MOVE,birdMove);
stage.removeEventListener(MouseEvent.MOUSE_UP,birdRelease);
}
Test the movie and you will be able to move your bird inside the sling area.
Once you release the movie, you will see some text in the output window with
the release coordinates.
In the previous screenshot, a bird released at this position will output:
bird released at 44,274
This is all we need to shoot our physics bird.
 
Search WWH ::




Custom Search