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

2012/6/9

World to move on too the next world after completing the other,

1
2
3
copyrightkid copyrightkid

2012/6/10

#
how can i let you see the coding?
danpost danpost

2012/6/10

#
Before you 'Publish' it, you must first check the checkbox that asks to 'Include source code'.
copyrightkid copyrightkid

2012/6/10

#
http://www.greenfoot.org/scenarios/5440
danpost danpost

2012/6/10

#
I've got it! If you want, you can login, go to your scenario, and click on 'delete scenario' to remove it.
copyrightkid copyrightkid

2012/6/10

#
where was i going wrong?
danpost danpost

2012/6/10

#
I am looking into it. Be patient.
copyrightkid copyrightkid

2012/6/10

#
haha :D
danpost danpost

2012/6/10

#
OK, first thing: you need your Mouse class to extend Collectable and your Collectable to extend Actor. Then, you need to move the last line in all your prepare methods in all your worlds to an act method
public void act()
{
    if (getObjects(Collectable.class).isEmpty()) setWorld(new NameOfWorld());
}
In your 'GameLevelOne' world: remove all the 'removeObject', 'new Collectable()', and 'addObject(collectable type)' statements. You should only have Mouse and Snake creations and adds here. For your 'GameLevelTwo' world: Grass should extend Collectable. Etc. for the other levels.
danpost danpost

2012/6/10

#
Also, I was getting compile errors when I first opened the scenario. I added blank constructors to the Mouse, Sheep, and the Pig1 classes. Example (using Mouse)
public Mouse()
{
}
copyrightkid copyrightkid

2012/6/10

#
It still says cannot find symbol 'getObjects' ?
danpost danpost

2012/6/10

#
What class and what line of the code are you getting this error?
copyrightkid copyrightkid

2012/6/12

#
Actor - Collectable - Mouse, 'setWorld' ? Cannot find symbol
danpost danpost

2012/6/12

#
'setWorld' needs to be prefixed with 'Greenfoot' Greenfoot.setWorld(new NameOfWorld());
copyrightkid copyrightkid

2012/6/12

#
Yeah it has worked, just got to solve the problem of it going to the next level before completing then a pop menu. Nearly There Know. Thank You
nha nha

2012/6/26

#
'setWorld' needs to be prefixed with 'Greenfoot' Greenfoot.setWorld(new NameOfWorld()); Hi, I just copy paste your source code and change NameOfWorld() into world that i have created. but still the error saying that cannot find symbol - method setWorld(); appear. Is something wrong with the compiler or other problem?
There are more replies on the next page.
1
2
3