Results 1 to 3 of 3
Thread: Combining shapes?
- 06-14-2011, 08:07 PM #1Member
- Join Date
- Jun 2011
- Rep Power
I wondered if anyone could advise?
I am trying to write a very simple target game in java, with a flying spaceship moving from left to right at the top of the JPanel.
I was trying to build a flying saucer, with a circle for the window part and oval for the main part.
I wondered how best to combin the two shapes, so I could move the two combined together using one set of x and y? Could I use the Area Class?
- 06-14-2011, 08:19 PM #2
One solution might just be to have a draw(Graphics g) method in your SpaceShip class, which uses its x and y to draw itself however you want. Then call that method from the paintComponent(Graphics g) method you overrode, passing in the Graphics as a parameter.
- 06-14-2011, 09:09 PM #3
- By trakke in forum New To JavaReplies: 5Last Post: 04-28-2011, 09:32 PM
- By meth in forum New To JavaReplies: 0Last Post: 01-20-2011, 01:35 PM
- By fresh83 in forum New To JavaReplies: 14Last Post: 12-28-2009, 09:52 AM
- By jaiminparikh in forum Advanced JavaReplies: 22Last Post: 02-18-2009, 06:35 PM
- By kewlgeye in forum New To JavaReplies: 5Last Post: 04-22-2008, 09:58 AM