• Post Reply Bookmark Topic Watch Topic
  • New Topic

can't call on a class  RSS feed

 
chris barr
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this code doesn't work and i don't know why ... i call on a different class in the exact same fashion else were ��?
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by chris barr:
this code doesn't work and i don't know why ... i call on a different class in the exact same fashion else were ��?


It appears that you are trying to call the constructor of HitPointManager. You don't want to do that unless you are creating an instance.
 
chris barr
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using it to make a progressbar update ever 1000mils. is that not the way that i would go about doing that .. and do you want the other classes code for help��?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you expect to happen when you call hpm.HitPointManager()?
 
chris barr
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't get that far.i get an error when the compiler gets to

well i am trying to make the method add 5 to hp every second and i don't know how to use a timer so i was sorta hoping that it would work ...

i have also tryied to use a timer another way witch also doesn't work for me.. it compiles it just doesn't do anything.

is one way better than the other ... or does it matter��?
[ June 13, 2006: Message edited by: chris barr ]
 
Ådne Brunborg
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you get a compilation code at

int regen = hpm.HitPointManager();

because
1) the hpm-instance doesn't have a method called HitPointManager()
or
2) the return type for the HitPointManager() method is not an int

What you want to do, is to tell the hpm-instance that it's regnereation rate is 5, right? You need to do the following:

- either; in the constructor of the HitPointManager, take a int regenRate as an argument


- or; make a set-method on the HitPointManager: setRegenerationRate(int i)
 
chris barr
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks ... now when i do

it doesn't give me a compile error anymore
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!