This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
Discussions
You need to login to take part
Current Discussions
my problem in source code is illegal character:\8211.what is that?im not understand about this
By fiki, with 1 reply.
Replied to by mjrb4, over 10 years ago:
8211 is an alternative dash (-) symbol in a different character set, where I have seen this message it's where people have copied code off a site that doesn't use the correct ascii based dash symbol, and thus causes issues. Have a look through your code and re-type any dashes (the error should give you the line number the suspect character is on which will make this much easier.)
Life system isn't working
By sihaco, with no replies.
I have a class Tumbler and a subclass of Tumbler called Life. The Tumbler has a public field called lifes which is initially equal to 3. When the Tubmler hits an object of the class Car, the field lifes should decreased with one (lifes = lifes - 1). In the class Life (subclass of Tumbler) I have code to remove one object of Life (which is a heart symbol). The problem is, instead of doing lifes = lifes - 1 (so the first time, it should be 3 - 1 = 2) lifes gets a value of -185. This is the code for the method when the Tumbler hits a Car: <Code Omitted> And this is the code for Life: <Code Omitted> Both methods are called from the act method. What's the problem? It should simply just do life - 1, instead of making the value of life equal to -100 +.
Piggie change direction
By ddvink, with 2 replies.
Last reply by danpost, over 10 years ago:
The 'checkFloor' method only lets you know if you are on an end floor; but does not let you know which end. So, your actor needs more information to determine which way to go. The simple solution is to ask whether the x location of the actor is greater than or less than half the width of the world. <Code Omitted>I may have '1' and '2' arranged incorrectly; but, the main idea should be apparent.
Starting at a random interval
By Baenefin, with 4 replies.
Last reply by danpost, over 10 years ago:
I guess you could change 'if (j >= 250)' to something like 'if (j >= 225+Greenfoot.getRandomNumber(50))' to vary the intervals.
Animation stays behind char
By ddvink, with no replies.
Dear all, I have a game where I control a character. When the character levels an object is called from a levelup class where an animation takes place. This animation is about twenty images. Everything looks ok, but when the char levels and walks on, the animation stays behind. Is there a way to move that animation with the character? Yours, Dennis
to end a game
By sophiefordream, with 2 replies.
Last reply by danpost, over 10 years ago:
In the world class, you can use 'getObjects(null).isEmpty()' to see if no actors are in the world. For a specific set of actors, you will need to combine them like this 'getObjects(Butterfly.class).isEmpty && getObjects(Elephant.class).isEmpty() && /* etc */'.
my program stop
By sophiefordream, with 7 replies.
Last reply by sophiefordream, over 10 years ago:
thanks.....^^
Why does my for loop add the course to every element?
By thekidj, with 1 reply.
Replied to by erdelf, over 10 years ago:
why are u using a for-loop when u just want one index to be set`?
Passing background music to other worlds and controlling.
By Tavi, with 4 replies.
Last reply by danpost, over 10 years ago:
Remove line 39. Line 45 needs to be moved elsewhere (to wherever the next level is called).
keeping and incrementing a score
By i_joker123, with 7 replies.
Last reply by danpost, over 10 years ago:
Change line 18 to 'if (getWorld() != null) collide();'. (when 'go_off' removes the actor, 'collide' cannot get intersectors).
NullPointerException
By Lee1121, with 4 replies.
Last reply by Lee1121, over 10 years ago:
danpost wrote...
Line 15 in the Enemy class assigns dungeonWorld a value using 'getWorld()' which has a value of 'null' at the time the assignment takes place. The assignment of the fields take place during the construction of the object and the object is never added into any world until construction is complete. To assign the proper value to that field, you need to make use of the 'addedToWorld' method supplied by the Actor class. <Code Omitted>The 'addedToWorld(World)' method is automatically called by th
Spawning according to lifecounter
By Baenefin, with 11 replies.
Last reply by danpost, over 10 years ago:
Try: <Code Omitted>
Game Over
By Mar_Om, with no replies.
Hello, I'm trying to adjust the color and font of the string on the World. Here is what I've got so far. Tanks <Code Omitted>
collision of more than one object at a time.
By i_joker123, with 2 replies.
Last reply by i_joker123, over 10 years ago:
public class baddie extends Actor { /** * Act - do whatever the arrow wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ private int speed; public void act() { // Add your action code here. MouseInfo mouse = Greenfoot.getMouseInfo(); if (mouse !=null) setRotation((int)(180*Math.atan2(mouse.getY()-getY(),mouse.getX()-getX())/Math.PI)); move(speed); if(Greenfoot.mouseClicked(null)) {
for() loops... how to use? -gruver
By ksksks, with 2 replies.
Last reply by ksksks, over 10 years ago:
I don't read that kind of type well, I have poor eyesight. Also, I was trying to find a way that would explain better than my textbook.
767
768
769
770
771
772
773
X