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
Select an object to move
By kevin2106, with 7 replies.
Last reply by sjoerdieman, almost 11 years ago:
its fun to see other people asking stuff about the same school project ;)
unreachable statement int
By sjoerdieman, with 3 replies.
Last reply by sjoerdieman, almost 11 years ago:
Thanks it worked!
Making objects move problem
By bigdaddyrooster2, with 4 replies.
Last reply by bigdaddyrooster2, almost 11 years ago:
Thanks a million man, that fixes it.
Run a method from another object
By Alex1s, with 8 replies.
Last reply by danpost, almost 11 years ago:
'getWorld' is a method of the World class, created long before you wrote your subclass of it. It can only return a World object (which can be from any subclass of World). It cannot return your world specifically as a 'RoboterWelt' world object; so, you must inform the compiler that it is indeed one so it knows to look in that class for the method.
Question!
By inkpenKingpin, with 2 replies.
Last reply by inkpenKingpin, almost 11 years ago:
I made a method for each of them like you suggested "bCost" wCost" and "bValue" each as integers, bCost and bValue returned 1, and wCost returned 0. I'll cut out a piece of the code for an example. <Code Omitted> ^ Wall class
Still need help on 3d
By wabuilderman, with 3 replies.
Last reply by wabuilderman, almost 11 years ago:
Oh, but yes, I do want to do raycast. This project is primarily for the learning experience, and just in general, trying to master the art of 3d rendering. I will probably copy my code and try doing it another way.
AWESOME 3d tutorial
By wabuilderman, with 1 reply.
Replied to by wabuilderman, almost 11 years ago:
scratch that, it doesn't cover everything.. But still, good tutorial.
Hey how can i add 3 background music for may 3 levels.
By TanRanoa, with no replies.
Please Help! :)
Hey I need Help. Im Having a problem to add a background music.
By TanRanoa, with no replies.
THIS IS MY CODES import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class MyWorld extends World { private GreenfootSound bgMusic = new GreenfootSound("All About That Bass"); public void started() { bgMusic.playLoop(); } Counter counter = new Counter(); public MyWorld() { // Create a new world with 600x400 cells with a cell size of 1x1 pixel super(790, 445, 1, false); prepare(); } public Counter getCounter() { return counter; } private void prepare() { addObject(counter, 100, 40); Blue BlueColor = new Blue(); addObject(BlueColor, 50 , 100); Green GreenColor = new Green(); addObject(GreenColor, 50 , 180); Purple PurpleColor = new Purple(); addObject(PurpleColor, 50 , 260); Red RedColor = new Red(); addObject(RedColor, 50 , 340); addObject(counter, 1000, 40); Water WaterColor = new Water(); addObject(WaterColor, 1000 , 100); Land LandColor = new Land(); addObject(LandColor, 900 , 180); Air AirColor = new Air(); addObject(AirColor, 800 , 260); Fire FireColor = new Fire(); addObject(FireColor, 1200 , 340); Tubig TubigColor = new Tubig(); addObject(TubigColor, 1400 , 100); Lupa LupaColor = new Lupa(); addObject(LupaColor, 1300 , 180); Hangin HanginColor = new Hangin(); addObject(HanginColor, 1100 , 260); Apoy ApoyColor = new Apoy(); addObject(ApoyColor, 1500 , 340); Bb BbColor = new Bb(); addObject(BbColor, 1600 , 100); Ll LlColor = new Ll(); addObject(LlColor, 1800 , 180); Aa AaColor = new Aa(); addObject(AaColor, 1700 , 260); Ff FfColor = new Ff(); addObject(FfColor, 1900 , 340); Waterb WaterbColor = new Waterb(); addObject(WaterColor, 2000 , 100); Landl LandlColor = new Landl(); addObject(LandColor, 2100 , 180); Aira AiraColor = new Aira(); addObject(AiraColor, 2300 , 260); Firef FirefColor = new Firef(); addObject(FirefColor, 2200 , 340); Bee BeeColor = new Bee(); addObject(BeeColor, 2500 , 100); Gee GeeColor = new Gee(); addObject(GeeColor, 2700 , 180); Pee PeeColor = new Pee(); addObject(PeeColor, 2600 , 260); Fee FeeColor = new Fee(); addObject(FeeColor, 2800 , 340); Beer BeerColor = new Beer(); addObject(BeerColor, 2900 , 100); Geer GeerColor = new Geer(); addObject(GeerColor, 3100 , 180); Peer PeerColor = new Peer(); addObject(PeerColor, 3000 , 260); Feer FeerColor = new Feer(); addObject(FeerColor, 3200 , 340); Bbb BbbColor = new Bbb(); addObject(BbbColor, 3400 , 100); Ggg GggColor = new Ggg(); addObject(GggColor, 3300 , 180); Ppp PppColor = new Ppp(); addObject(PppColor, 3500 , 260); Fff FffColor = new Fff(); addObject(FffColor, 3600 , 340); Bluer BluerColor = new Bluer(); addObject(BluerColor, 4200 , 100); Greener GreenerColor = new Greener(); addObject(GreenerColor, 4100 , 180); Purpler PurplerColor = new Purpler(); addObject(PurplerColor, 4300 , 260); Reder RederColor = new Reder(); addObject(RederColor, 4400 , 340); Blew BlewColor = new Blew(); addObject(BlewColor, 4600 , 100); Greek GreekColor = new Greek(); addObject(GreekColor, 4800 , 180); Prend PrendColor = new Prend(); addObject(PrendColor, 4700 , 260); Fight FightColor = new Fight(); addObject(FightColor, 4500 , 340); Beee BeeeColor = new Beee(); addObject(BeeeColor, 4900 , 100); Geee GeeeColor = new Geee(); addObject(GeeeColor, 5000 , 180); Peee PeeeColor = new Peee(); addObject(PeeeColor, 5200 , 260); Feee FeeeColor = new Feee(); addObject(FeeeColor, 5100 , 340); } public void stopped() { bgMusic.stop(); } { } }
headache java.lang.NullPointerException
By guntur, with 1 reply.
Replied to by danpost, almost 11 years ago:
You cannot execute a method on an object reference that does not contain an object, but contain a 'null' reference. Once you remove 'this' from the world 'getWorld' will return 'null'. Move the 'removeobject(this)' line down past where you use 'getWorld' (before, or after, the 'Greenfoot.stop()' call).
raycasting headache
By wabuilderman, with 1 reply.
Replied to by davmac, almost 11 years ago:
So far, the best thing I have that works (though it still doesn't really work) is this: (...) using this, it would determine if one face in a list is closer than another. It would then go about rearranging them using this method.
I think you have one or two conceptual misunderstandings. First, it is not possible to sort a set of faces by "distance to a point" in a way that is useful for rendering (whether it be by raycasting or not); for one thing, you render many points (whatever the dimensions of your screen or viewport are), not just the one, and faces that are closer to o
How to display a level screen in the world and change when actor dies
By cloud41910, with 3 replies.
Last reply by danpost, almost 11 years ago:
There is no problem with the naming. The main problem ... well, there are two here. (1) every act cycle you will be creating and adding a new Level object into the world which will most certainly either (a) create lag (b) cause an OutOfMemory error and/or (c) cause a StackOverflow error; and, (2) the moment 'hit' removes the actor from the world, 'world' will be assigned a 'null' value on line 32 and a NullPointerException will occur on line 34 when you try to call methods on 'world'. If you only want to add a new Level object into the world when your player dies, then put the code to a
Jump code..
By JetLennit, with 24 replies.
Last reply by danpost, almost 11 years ago:
@ZeroKnightZK, you should start a new discussion thread and post code you have tried.
Need help adding text
By csmith7, with 3 replies.
Last reply by danpost, almost 11 years ago:
Like line 5 but with a different text string.
Getting an Error Message When I Kill an Enemy
By Kickero, with 1 reply.
Replied to by danpost, almost 11 years ago:
The error occurs when the health of the actor gets to zero. When this happens, your act method is calling 'SirBAlert' which calls 'checkSirB'. Your health values goes to zero or below and the porcubutt is removed from the world. Execution then returns back to the act method, when 'checkAttack' is called. This method can execute fully as written without any problems because nothing in the method requires the actor be in the world (it only deals with fields and keystrokes). Then, finally execution back at the act method calls the method 'move'. The first line in that method (line 54 above
623
624
625
626
627
628
629
X