Results 1 to 2 of 2
- 04-11-2012, 05:10 AM #1
How to fire cannon balls out of a rotatable cannon
I'm creating a game where you rotate a cannon, at the bottom of the screen, clockwise and counterclockwise with the left and right arrow keys. When you press space a cannonball fires out of the cannon at the appropriate angle. For example, if the cannon was rotated 45 degrees the cannon ball would move 20 pixels to the right and 20 pixels up every step.
I have everything besides the actual formula for creating the rise over run for the cannon ball.
Here is how the cannon ball moves, dictated by the move method:
I want to convert the angle of the cannon into a xspeed and yspeed for the cannonball.Java Code:public void move() { x += xspeed; y += yspeed; }
Any help or advice would be greatly appreciated.
- 04-11-2012, 07:03 AM #2
Re: How to fire cannon balls out of a rotatable cannon
Why do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
More bouncing balls...
By ShaolinMunky in forum New To JavaReplies: 5Last Post: 06-10-2012, 09:43 AM -
how to add more balls via user input
By Johnny2009 in forum New To JavaReplies: 22Last Post: 12-12-2011, 02:33 AM -
ArrayList and Bouncing Balls
By jamie23 in forum AWT / SwingReplies: 1Last Post: 02-20-2011, 06:54 PM -
Multiple bouncing balls
By Algar in forum AWT / SwingReplies: 2Last Post: 04-24-2008, 08:35 PM -
Movement of balls
By BlitzA in forum New To JavaReplies: 8Last Post: 01-09-2008, 03:30 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks