I'm trying to make it that the world will spawn spikes within itself at random coordinates every 6 seconds. It is not the same 'counter' field that is declared near the top of the class.As I said, i'm very new to coding. Again the 'counter' variable is declared within the 'for' statement and its scope is limited to the 'for' loop. I did notice the somewhat strange use of the 'for' loop using a 'counter' variable. That is ambiguous, as it could be interpreted as being in context with time or with space (locations throughout the map). Your initial statement used the phrase 'at set intervals' when referring to the random spawning of spikes throughout your map. Still, assigning it after calling 'addSpikes', when the method needs it assigned first, is kind of pointless. If that be the case, you could just remove the 'int' at the beginning of the line thereby, not declaring a local field, but using the static field declared above. Maybe you intended that this line assign a value to your static field with the same name. It creates and assigns a variable that is local to the constructor (its scope is bound to the constructor itself) then, it is ignored that is, it is not ever referred to or utilized later within the constructor. Line 14 is what I call a 'hanger' line - it has no purpose. Java uses object orientation, a programming paradigm that represents concepts as objects. In fact, it is never assigned a different value EVER. Greenfoot is a visual and interactive computer program that uses Java to build games, simulations and other graphical programs. The static field, 'randomNumber' has an initial value of '0' and it is never assigned a different value before the 'addSpikes' method is called in the world constructor. Line 19 compares the value of 'randomNumber' with '0' and will find it never to be greater than '0'. It is not the same 'counter' field that is declared near the top of the class.ĭanpost wrote.The code given will never add spikes into the world, as is. quickly quick written kelowna green foot college if topics black. serious albert silver sites lds get world portugal any northampton norton. It creates and assigns a variable that is local to the constructor (its scope is bound to the constructor itself) then, it is ignored that is, it is not ever referred to or utilized later within the constructor. addiction cheetah 2013 new karte get world percent esl romantic. benefits send earn past green foot chaperone hudson ugly. In fact, it is never assigned a different value EVER. If (getOneIntersectingObject(Some.The code given will never add spikes into the world, as is. The 'Actor is not in world' exception can occur when your code tries to do something which depends on the location of an actor, after the actor has already been removed from the world. IllegalStateException: Actor is not in world
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |