There is a way to create an Actor or World object that does not belong to any pre-defined subclass even though those classes are abstract. Thought of the day: how can a program ever return a false value when asked if it is running? (if it is not running, then what is causing the statement to be executed). Anyway, it is nothing like the 'isPlaying' method. If the crab is still at the edge when the. The Crab object will then always keep a reference to the one GreenfootSound object created (instead of creating multiple GreenfootSound object and having them play over the top of each other). While its value is positive, decrement its value. First, move line 16 to outside the method. When a bullet is created, set the field to some positive value. Now, to add a delay between bullets created you will need to add an int field to the Shooter class as an act counter. There may be instances where you may want to call it however, it is mainly called internally by greenfoot when the 'Pause' button is clicked or a 'Greenfoot.stop()' method is executed (when the scenario goes from a running state to a stopped state). In the same sense, a Bullet class should not extend a Shooter class. Finally, the 'stopped' method is usually not called explicitly. Second, the return type of the 'stopped' method is void, meaning that it will not return a true/false value. This means you must supply a world object to execute the method on (which world object is the method being called on). First, the 'stopped' method is not a static method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |