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

2012/3/31

i need help uploading my scenario

1
2
JayWood860 JayWood860

2012/3/31

#
i tried sharing my scenario through greenfoot but a message said "Publish failed: The scenario is too large" What can i do to fix this? i can't reduce the world size because i will have to adjust all of my code so my game will be right. anything i can do?
danpost danpost

2012/3/31

#
The message does not mean that your world is too large, it means that your scenario file-size is too large. This usually occurs when users have large (or many) sound files.
JayWood860 JayWood860

2012/3/31

#
thank you, i deleted some of the sound files and my scenario was uploaded
qsapp.3 qsapp.3

2013/7/16

#
is there any other reason itd do that? because i trimmed my music down deleted what wasnt nessessary and deleted some images that i didnt use and it still says my scenario is too large. how can i fix this?
danpost danpost

2013/7/16

#
@qsapp.3, maybe there is a way you can combine similar classes into one using a constructor argument and/or an instance field to distinguish between them. Also, if you have large data files, maybe you can find a way to condense it/them and programmatically decode them. If using an extensive 'prepare' method in your world class, you could probably eliminate a lot of code by rewriting it (add each object at the final setLocation coordinates for each object and remove all the setLocation statements; create 'for' loops to add objects where possible; things like that). These are just a few ways to help reduce the size of your scenario.
qsapp.3 qsapp.3

2013/7/16

#
how would i do that? say i have finish1,finish2,finish3,finish4. and my MainPlayer has different levels based on how each finish take the MainPlayer to a new level.
qsapp.3 qsapp.3

2013/7/16

#
MainPlayer
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Main player. Gets controlled by user.
 * 
 * @author (Quinn Sapp) 
 * @version (11 July 2013)
 */
public class MainPlayer extends Animal
{
    private Counter counter;
    public MainPlayer(Counter pointCounter){
        counter = pointCounter;
    }// end of Counter
    public void act(){
        checkKeyPress();
        lookForPoint();
        lookForFinish();
        gameOver();
        checkNextLevel();
        checkNextLevel2();
        checkNextLevel3();
        checkNextLevel4();
    }// end act
    public void checkKeyPress(){
        if (Greenfoot.isKeyDown("left")){
            turn(-4);
        }//end if
        if (Greenfoot.isKeyDown("right")){
            turn(4);
        }//end if
        if (Greenfoot.isKeyDown("space")){
            move(2);
        }//end if
    }//end checkKeys
    public void lookForPoint(){
       if (canSee(Point.class)){
        eat(Point.class);
        counter.add(1);
        Greenfoot.playSound("slurp.wav");
       }//end if
       if(counter.getValue() >= 35){
       }//end if
    }  //end lookForPoint
    public void lookForFinish(){
       if (canSee(Finish.class)){
        eat(Finish.class);
        counter.add(1);
        Greenfoot.playSound("slurp.wav");
       }//end if
       if(counter.getValue() >= 35){
       }//end if
    }  //end lookForFinish
    public void gameOver(){
        if (counter.getValue() >= 15)
        Greenfoot.setWorld(new Level4());
    }//end gameOver    
    public void checkNextLevel(){   
       if (getOneIntersectingObject(Finish.class) != null) {  
         //reached the end object;
         //start the new level;  
        Greenfoot.setWorld(new MainWorld());
       }//end if
    }//end checkNextLevel
    public void checkNextLevel2(){   
       if (getOneIntersectingObject(Finish2.class) != null) {  
         //reached the end object;
         //start the new level;  
        Greenfoot.setWorld(new Level2());
       }//end if
    }//end checkNextLevel2
    public void checkNextLevel3(){   
       if (getOneIntersectingObject(Finish3.class) != null) {  
         //reached the end object;
         //start the new level;  
        Greenfoot.setWorld(new Level3());
       }//end if  
    }//end checkNextLevel3
    public void checkNextLevel4(){   
       if (getOneIntersectingObject(Finish4.class) != null) {  
         //reached the end object;
         //start the new level;  
         Greenfoot.setWorld(new Level5());
       }//end if  
    }//end checkNextLevel4
}//end MainPlayer
qsapp.3 qsapp.3

2013/7/16

#
All of the finishes dont have any code specific more just something to put on the map.
danpost danpost

2013/7/16

#
You could have just one Finish class and the code in the MainPlayer class dealing with it like this:
if (getOneIntersectingObject(Finish.class0 != null)
{
    World world = null;
    if (getWorld() instanceof MainWorld) world = new Level2();
    if (getWorld() instanceof Level2) world = new Level3();
    // etc...
    Greenfoot.setWorld(world);
}
The code above can be in one method as well (instead of using multiple methods). Please note that since I am not aware of the exact order that your worlds appear, you will probably have to adjust what world is set from which.
qsapp.3 qsapp.3

2013/7/17

#
it says illegal start type
danpost danpost

2013/7/17

#
Please show the updated class code.
qsapp.3 qsapp.3

2013/7/17

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Main player. Gets controlled by user.
 * 
 * @author (Quinn Sapp) 
 * @version (11 July 2013)
 */
public class MainPlayer extends Animal
{
    private Counter counter;
    public MainPlayer(Counter pointCounter){
        counter = pointCounter;
    }// end of Counter
    public void act(){
        checkKeyPress();
        lookForPoint();
        lookForFinish();
        gameOver();
        checkNextLevel();
        checkNextLevel2();
        checkNextLevel3();
        checkNextLevel4();
    }// end act
    public void checkKeyPress(){
        if (Greenfoot.isKeyDown("left")){
            turn(-4);
        }//end if
        if (Greenfoot.isKeyDown("right")){
            turn(4);
        }//end if
        if (Greenfoot.isKeyDown("space")){
            move(2);
        }//end if
    }//end checkKeys
    public void lookForPoint(){
       if (canSee(Point.class)){
        eat(Point.class);
        counter.add(1);
        Greenfoot.playSound("slurp.wav");
       }//end if
       if(counter.getValue() >= 35){
       }//end if
    }  //end lookForPoint
    public void lookForFinish(){
       if (canSee(Finish.class)){
        eat(Finish.class);
        counter.add(1);
        Greenfoot.playSound("slurp.wav");
       }//end if
       if(counter.getValue() >= 35){
       }//end if
    }  //end lookForFinish
    public void gameOver(){
        if (counter.getValue() >= 15)
        Greenfoot.setWorld(new Level4());
    }//end gameOver    
    if (getOneIntersectingObject(Finish.class0 != null){
    {  
        World world = null;  
        if (getWorld() instanceof MainWorld) world = new Level2();  
        if (getWorld() instanceof Level2) world = new Level3(); 
        if (getWorld() instanceof Level3) world = new Level4();
        if (getWorld() instanceof Level5) world = new WINNER();
       Greenfoot.setWorld(world);  
    }  
    }//end checkNextLevel4
}//end MainPlayer
danpost danpost

2013/7/17

#
I said that the code I gave could go in a method. Replace lines 58 through 67 with the following:
public void checkNextLevel()
{
    if (getOneIntersectingObject(Finish.class) != null)
    {  
        World world = null;  
        if (getWorld() instanceof MainWorld) world = new Level2();  
        if (getWorld() instanceof Level2) world = new Level3(); 
        if (getWorld() instanceof Level3) world = new Level4();
        if (getWorld() instanceof Level5) world = new WINNER();
        Greenfoot.setWorld(world);  
    }
}
With this method you can remove lines 21 through 23 (at least that will get you closer to what you want).
qsapp.3 qsapp.3

2013/7/17

#
I completed that and it still tells me that my scenario is to large
qsapp.3 qsapp.3

2013/7/17

#
Thank you very much i fixed it
There are more replies on the next page.
1
2