This site requires JavaScript, please enable it in your browser!
Greenfoot back
niklaskar
niklaskar wrote ...

2012/6/7

Help with Space Invaders

niklaskar niklaskar

2012/6/7

#
At the moment we're trying to program space invaders in our informatics course. My Program is working really fine except for the fact, that the score gets reset at the end of every act. Could somebody help me pls? The Parent class named "Management" manages the score and a few other things, the method "addiereScore(int wert)" is called from the class "Schuss". Sry for the German class names ;) I have uploaded the project as a .zip file @ http://www.niklaskar.de/filez/space_invaders.zip Thanks for helping me :) Niklas
ttamasu ttamasu

2012/6/8

#
since "Managment" is the super class for all your other objects, it will used the constructor, it will alway set score to zero since it will inherit the Management constructor which will reset your public score variable. Two things I would try: 1) remove the score = 0 form the constructor in the Management constructor 2) change the public score ; declaration to private static score; // score is automatically set to zero cheers Takashi
You need to login to post a reply.