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

danpost's Comments

Back to danpost's profile

@al_griff, the previous post has the code to do what I believe you wanted to do. The last line should probably read 'super.act()' (in case you add an act to your world -- if you do, make sure you call 'super.act()' in it also or the scrolling will not work).
My main actor is a Wombat object. To start him on the left edge of the scrollable world, the following can be used in the constructor for the subclass of SWorld: Wombat wombat = new Wombat(); // creates the main actor setMainActor(wombat, 250, 300); // sets as main actor and sets its range of movement GreenfootImage bg = new GreenfootImage("scene.jpg"); // create background image setScrollingBackground(bg); // set the scolling background image int leftOffset = -getUnivX(wombat.getX()); // get -offset from left edge of scroll world wombat.move(leftOffset); // move actor to left edge of scroll world act(); // adjust the scrolling background // add the rest of your objects
@al_griff, are you wanting your main actor to start at the left edge of the scroll world?
Now, you need running counters for player and cpu (and ties, if you want).
@Sockman101, thank you very much.
Well, how it works currently is it gives a NullPointerException during loading.
This is a glorified tic-tac-toe. Try to get three in a row horizontally or vertically along the same connected line. Click on one of your men, then click on the empty place you wish to put it. Alternate turns placing one at a time.
Oh, I see. You have to reset it for each new game. You should have it pick a new random selection each time the player clicks on one of the options and show the new result.
The CPU seems to always pick Rock no matter what!