This site requires JavaScript, please enable it in your browser!
Greenfoot_back

What is happening right now?

8879_thumb

reply to calling variable from new World subclass

By Alwin_Gerrits - 15 minutes ago
davmac wrote...
A static variable is a variable which belongs to a class instead of to instances of the class.
So then does that mean it's like variables you declare as a global variable? I think there has to be a difference, but it's vacation here so I can't really bother my teacher about it and class has been going to slow to get to this subject yet -_-. I guess regardless of my lacking knowledge, I'm not beïng very clear about what i'm trying to do. So here's the scenario: I'm making a platform game where the player can pick up certain items to get a powerup. What I want to get done is that when the player has a powerup and is moving to the second level he doesn't lose his powerup. My method 'Fire' up until not contained nothing but the boolean canFire which would determine whether the player picked up the powerup that lets him fire. I guess that's all i'm trying to do right now... i'll try looking into static and final myself, but plz your vision on how to take down this problem i'm having.
Happyjoe_thumb

reply to CHALLENGE 17 || October 2014

By lordhershey - about 4 hours ago
A couple weeks would help, I am working on something and after that I will be out of commission for quite a while.
Fractal_r3800c0s800f10000t0z80x0y0_thumb

reply to BlackJack Tutorial

By danpost - about 8 hours ago
Your first line starts the class with a '{' and also ends it with '}'. Then, it appears you are defining another class with the same name on the next line. I cannot tell from what is given exactly what you intended this code to do. However, it looks like you were trying to pass data to the class for use within it. I think you wanted to pass data to its constructor so the deck object created could use those values. In that case, your code should start like such: <Code Omitted>Line 1 declares the class and line 3 heads the constructor of the class, called when the class is instantiated (or, when an object is created from the class -- when 'new deck(...)' is called). Notice the entire class is enclosed within curly brackets -- the fields, constructors, and methods.
Fractal_r3800c0s800f10000t0z80x0y0_thumb

reply to Variables Reset Glitch

By danpost - about 9 hours ago
Every time you create a new Rock object, it, the new Rock object, receives its own 'L' and 'N' fields for its use. If you want all Rock objects to share the same 'L' and 'N' fields, they you need to declare them as static fields: <Code Omitted>Their default initial values will be zero; however, because the values of static fields are retained during resetting of the project, you should explicitly set them to zero in the constructor of your subclass of World, using: <Code Omitted>
8879_thumb

reply to Image isn't appearing...

By Alwin_Gerrits - about 10 hours ago
I think you should post your code which determines where to place the image in your world as well. Because for as far as I can see there doesn't seem to be large problems with your code, but if you're not placing it in your world it's obviously not going to appear. So maybe place the code where you use something like addObject(new PortonWave); or whatever you used to place it in your world. It can be I can't help much even if you post it, but the people with more experience can at least help you faster if you post that part of the code right now.