java - Adding a shape to class properties -


i working on game has class player, there 3 subclasses of player. these different types of players have different methods , variables. anyhow want give each player different look. start basic now, i'm thinking rectangle 1 player, circle , triangle other.

what wondering how best implement this? iv thought adding method each player draws different shape using paint component. don't think correct though particular shape should property of player not method (i think) there way me declare shape each player , call on shape in gui , draw there....

i add class code example don't think question..

any insight appreciated!!!

thanks!

if got right design

import java.awt.rectangle; import java.awt.shape; public class myshape { //this player       protected shape shape;      draw(shape shape){         // code draw shape go here     } }  class myrectangle extends myshape { // rectangle_player_type     // initilization block runs before constructor     {         shape = new rectangle();     } } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -