java 2d game(naming items)

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2004
Posts: 44
Reputation: ultimate_fusion is an unknown quantity at this point 
Solved Threads: 0
ultimate_fusion ultimate_fusion is offline Offline
Light Poster

java 2d game(naming items)

 
0
  #1
Jun 25th, 2005
i want to name a item and give it a color(probs an int value)
i was thinking of doing a 2d array but I need to send it to another class
i create the item by
Monster m = new Monster(this);

any ideas
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 765
Reputation: Phaelax is on a distinguished road 
Solved Threads: 38
Phaelax Phaelax is offline Offline
Master Poster

Re: java 2d game(naming items)

 
0
  #2
Jun 28th, 2005
you need to be a little more specific of what you're trying to do.

i want to name a item and give it a color
that could mean something as simple as this:

  1. class Item
  2. {
  3. String name;
  4. Color color;
  5. public Item(String name, Color color)
  6. {
  7. this.name = name;
  8. this.color = color;
  9. }
  10. }
  11.  
  12. Item myItem = new Item("monster", new Color(147,54,175));
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC