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
setDirection
By ye-roon, with no replies.
Hello everyone, I'm quite new to all this and i dont know how to properly explain it, but i will try my best. Also, this would probably work best if i could upload the whole scenario somewhere, but i can not seem to find the upload button. My problem is as follows, i am currently creating a simple game, where a nerdy guy/loser needs to get to school. The main blueprint is done, and he can move and if he hits the wrong obstacle he fails. The powerups are in place but currently do not do anything, this was just done to see where they would be. Its for a school project and we were designated team L, hence the Loser ^^. The loser has 2 different kinds of moving enemies and 1 kind that is stationary(they are girls! so stationary is scary enough for our nerd). The moving enemies consist of a couple of Dogs and some Jocks that are always eager to make our Losers life misarable. So i was digging around in some code and i found that i could re-use some code from the wombat game to make our Enemies move. I made North 0, and South 1 and removed East and West since its a topdown game and the enemies do not have to move in another direction for now. Maybe if we expand on this project in the future, for now moving up and down is enough. So i changed the code from the wombat scenario in such a way that the enemy will turn around when he hits a piece of Furnature, we have put all our immovable objects as a subclass of Furnature(so walls, the doghouse, school tables). The reason for this is it makes it easier to program, for i can now just use: (Furnature.class), rather then having to make different statements for every piece of furnature. Our walls are set in a maze like pattern. The dogs move between their doghouses and the outerwall of the school. What it does now is: it will automaticly move towards the South. When it hits the the wall in the south, its set the direction to the North and they will happily move north. But then when they hit the north wall they get stuck in a loop and the only thing you can see is the image changing from setDirection(180) to setDirection(0). It doesnt move down anymore. I have tried this with both the isTouching() method and the getOneIntersectingObject() but both end up with the same problem. So i thought, well the images have different pixel sizes, what if i change one with a 30x30 image. But that didnt work either. I will paste the code below. So if anyone has an idea where this goes amiss, that will be gladly appreciated. Also, english is not my native language, so excuse my grammar/spelling mistakes, if applicable. Kind regards, ye-roon <Code Omitted>
make a rocket move
By smilyface999, with 2 replies.
Last reply by smilyface999, about 11 years ago:
cheers:)
Jump away from the rope
By ddvink, with no replies.
[Disallowed URL] In the image below the red arrows shows the way the char goes. I made a class with an image over the rope to climb on. Sometimes it works well and sometimes it kinda jumps away when he's almost finished climbing. Can someone explain why this happens? Yours, Dennis [Disallowed URL]
X-coords of a specific object
By ddvink, with 7 replies.
Last reply by SPower, about 11 years ago:
Did you also improve it like danpost said?
Broken Code?
By Y3llowMustang, with 3 replies.
Last reply by davmac, about 11 years ago:
It is as danpost says. The documentation for the method clearly states:
Set the current drawing color. This color will be used for subsequent drawing operations.
Cannot writeln()
By benskii93, with 2 replies.
Last reply by benskii93, about 11 years ago:
Yep, Don't really know why I got that wrong. Thanks a lot.
more getKey's
By ddvink, with 2 replies.
Last reply by ddvink, about 11 years ago:
Thanx!!!!!
Remove the little green foot logo?
By kolozz, with 2 replies.
Last reply by kolozz, about 11 years ago:
Thanks, it helped!
make a Highscore list
By Biri3010, with 2 replies.
Last reply by 12gatenbyr, about 11 years ago:
???
Making an actor carry over to another world
By winsticknova, with 8 replies.
Last reply by winsticknova, about 11 years ago:
wow!! it works! thank you so much! been working on this forever. you are awesome
Making enemy behaviour (Stubborn Switch)
By Tavi, with 12 replies.
Last reply by danpost, about 11 years ago:
There is no 'act' method in the Mover class, so you will have to add one to the platform class to create the movement. <Code Omitted>
STOP MOVING OBJECTS AT THE SAME TIME
By LuMC91, with 11 replies.
Last reply by danpost, about 11 years ago:
I makes a big difference. You could say a difference between 'All for one' and 'One for all' -- meaning non-static fields are for each instance (one for each instance ), while static fields are for all instances (the one field is shared by all instances).
Way to check if scenario is being played on the Gallery?
By Entity1037, with 6 replies.
Last reply by Entity1037, about 11 years ago:
Thank you!
I'm climbing damn high!
By ddvink, with 1 reply.
Replied to by Gevater_Tod4711, about 11 years ago:
You are using a while loop. That causes that your actor climbes up the liane in only one act. If you don't use any loops but just use an if clause your actor will climb up 10 cells every act.
Score Board?
By GameJunkie, with 1 reply.
Replied to by danpost, about 11 years ago:
You are probably just missing some 'import' statements that are needed for some of the objects you use. For example, Color.Black is a field in the Color class; so you need to 'import java.awt.Color;' to have access to it. The 'add' method is a List method, but in itself does not require you to import 'java.util.List'. However, if you use a 'List' anywhere in your code, you will have to.
778
779
780
781
782
783
784
X