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

2012/7/18

How to make a checkerboard

nerdgirl92 nerdgirl92

2012/7/18

#
I am new to programming, and very new to Java. I am trying to figure out how to make a checkerboard. Not one that you play. But I need help on making each specific square and calling it from the actor. I keep trying but I am at a loss. Can anyone point me in the right direction?
danpost danpost

2012/7/18

#
What do you mean by 'Not one that you play.'?
danpost danpost

2012/7/18

#
Also, what do you mean by '...calling it (a square?) from the actor.'
nerdgirl92 nerdgirl92

2012/7/18

#
I don't want it to be a game. I need to basically make each square of a checkerboard. Using drawRect() or whatever it needs to be. I need to make a pattern like a checkerboard with alternating colors.
nerdgirl92 nerdgirl92

2012/7/18

#
I need to make the checkerboard and it has to come from the actor, not the world. And the image is going to be used as the background.
nerdgirl92 nerdgirl92

2012/7/18

#
This is what I need to do "Create a new scenario. In it, create a world with a background that displays a pattern. Create an Actor subclass. Program the class so that it generates a new GreenfootImage of a fixed size, filled with a fixed color. Use this image as the actor’s image. Experiment with different color and alpha values." I figured I would make a checkerboard.
hipzebra hipzebra

2012/7/18

#
Why don’t you invest some time. Look around, you might be stunned by what you see at first glance. Mayb even a scenario that looks like a checkerboard with lots of colors. What do you see?
danpost danpost

2012/7/18

#
I was not sure how to explain it to you, you being new and all. What you originally said you needed to do would require some knowledge that an person with some experience would acquire.
nerdgirl92 wrote...
"Create a new scenario. In it, create a world with a background that displays a pattern. Create an Actor subclass. Program the class so that it generates a new GreenfootImage of a fixed size, filled with a fixed color. Use this image as the actor’s image. Experiment with different color and alpha values."
I now believe that you misunderstood what you needed to do for this assignment.. Create a new scenario. In it, (1) create a world with a background that displays a pattern. That would be your checkerboard, not as actors, just as the background of the world (2) create an Actor subclass; program the class so it generates a new GreenfootImage of a fixed size, filled with a fixed color. Use this image as the actor's image. Experiment with different color and alpha values. That would be your actor, a solid rectangle (or square). For (1) above, you could just set the image of the world with the checkerboard image (or any one of a number of images) supplied with Greenfoot. For (2), well, I believe that is the main challenge of this assignment. Just follow the instructions, step-by-step. You will find the methods needed in the Greenfoot class documentation and the Java library documentation (for Color). If you run into any specific problems, please do not hesitate to ask for help here. Be detailed and clear on what is happening, and what you want; and provide what code you may have (this could provide the helper a better understanding of what you are trying to do, and also may allow the helper to find and point out what may be amiss.
You need to login to post a reply.