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

2015/4/12

Setting certain osition by field & how to make actor appear in another world stepping on certain place !

1
2
danpost danpost

2015/4/18

#
You need to clean the code up a bit and remove all errors from it. * lines 29 through 38 of the Svet1 class declare local references to objects that are not later used within the method; those lines can be removed; * lines 45 and 46, plus lines 53 and 54, of the Svet1 class call 'getX' and 'getY' which are not defined in the Svet1 class (those are only Actor and MouseInfo class methods, they are not World class methods and cannot be called on a world object (from a subclass of World); * in the PocZiv class, 'text' and 'hodnota' are used multiple times throughout, but are not declared anywhere within the class; * line 16 in the PocZiv class is unreachable (you have an unconditional 'return' statement before it) * line 38 of the Hrac class tries to decrement a class; a class does not contain a numeric value; though, an object from the class may contain a field that holds a numeric value; you need a reference to that object to call a method that changes the field of that object by the given amount (I presume that would be a corrected 'snizeniHodnotty(int)' method); you may need to use the World class 'getObjects' method to retain the reference needed for the object by 'get'ting an element from the List object returned; * lines 18 through 20 of the Zivoty class declare varaibles 'z', 'X' and 'Y' that are not used later in the method; those lines can be removed; * line 25 of the Zivoty class has the same problem as line 38 of the Hrac class; you cannot increment a class; you can only increment numeric values;
Noa´RyiKarOOzo Noa´RyiKarOOzo

2015/4/19

#
Hello and thanks for the feedback from you, I think this must have scared you - all the mistakes i did and so on. I tried to correct them all as you mentioned so from now on i will try to make it all work at once. Can i contact you again if other problems will occur?
danpost danpost

2015/4/19

#
Noa´RyiKarOOzo wrote...
Hello and thanks for the feedback from you, I think this must have scared you - all the mistakes i did and so on. I tried to correct them all as you mentioned so from now on i will try to make it all work at once. Can i contact you again if other problems will occur?
It did not scare me as much as it concerned me. I could not believe that one would create or put together so much code without testing and correcting along the way. Besides writing the code, a good programmer will constantly test, inspect, correct, clean up and document the code. This programmer will also work on only one thing at a time -- get it working to their satisfaction and then move on to something else. This give them a sense of accomplishment or progress along the way. Also, when posting here, you are not supplying a bunch of gibberish code that no one could easily decipher to solve your issues. The forum will be at your disposal for help on other problems when they occur (and they will). There a quite a few users here that are capable of helping out. And with that -- good programming.
Noa´RyiKarOOzo Noa´RyiKarOOzo

2015/4/20

#
Hello again, Thank you for this letter, it really helped out. I was really desperate and sad about how you see me so i even thought you all hate me now. I hope it is not the case. And really thanks for this, it really helped. As you mentioned the errors and problems will occur so i had done few thing on that and corrected some parts of it, still working on it though. But i would need a little help with another think that i am not sure about. I wanted to create a timer that would count down my points for every move that i have done in the game when it runs. I cheked few codes and searched in my books about java and so on. However i still wasnt sure how to use it. Would you be so kind and help me with that code, please ? I just need to decrement the scorenumber that starts from 100 points by one everytime i move with my actor.
Super_Hippo Super_Hippo

2015/4/20

#
//outside methods
private int score = 100;

//whenever you move
score--;
You need to login to post a reply.
1
2