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

2012/5/6

What do you do to catch and throw an object. Finalize, catch, and throw

OGava OGava

2012/5/6

#
I'm looking to get a Player class to pick up an accumulation of spread of crumbled paper. The paper should/can then be thrown into recyclingBins set up in the corners of the map. Nothing on my map shows, i cant learn how to initialize shit, guess im just a greenfoot noobie. NO HONESTLY, i've been working on one program i restarted like 10 times now and i just give up at this point. sorry for the greenfoot unexpertiseness
OGava OGava

2012/5/6

#
public void recyclingBin(int Player) { Player = carryingPaper; tryCatchPaper(); setImage("recyclingBin.png"); if(Player(ThrowPaper) != null){ Actor recyclingBin = getOneObjectAtOffset(Paper.class); getWorld().removeObject(Paper.class); } public void finalize() { recyclingBin = garbageCollector(); if(Player(ThrowPaper)) { lookForPaper(); catchPaper(Paper.class); } } public void canSee() { eat(Paper.class); } public void paperCycled() { if(paperCycled == null) { paperCycled = new Counter("Paper: "); int x = getX(); int y = getY() + getImage().getWidth()/2 + 8; getWorld().addObject(paperCycled, x, y); } paperCycled.increment(); } }
OGava OGava

2012/5/6

#
public void finalize() { try { System.out.println("crumbledpaper.png"); new ThrowPaper("demo"); //clean-up code which is never reached because of exception } catch( Exception e) { System.out.println("Exception caught"); } finally { System.out.println("finally of callA"); //clean-up code written here which is executed } } public void tryThrowPaper() { Actor Player = getNeighboursInRange(recyclingBin.class); int distance; boolean diagonal; if(ThrowPaper.executed(tryCatchPaper)){ catch Paper.class(recyclinBin); recyclinBin(catchPaper); d =< 75; diagonal = true; } } nothing elsewhere works but the counters class from the site
OGava OGava

2012/5/6

#
RECYCLINGBIN PLAYER AND A LILBIT OF PAPER public void tryCatchPaper(recyclingBin) { if(RecyclingBin(tryCatchPaper)){ (Paper.class)goTorecyclingBin(); } } public void tryThrowpaper(Player) { if(Player(tryThrowPaper)){ (Paper.class)goTorecyclingBin(); } } IDENTIFIERS EXPECTED EVERYWHERE, EFFORT TO TRY, GONE LIKE THE WIND
You need to login to post a reply.