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

2014/9/10

HELP!! LEVEL PROBLEMS

sharifahhilwa sharifahhilwa

2014/9/10

#
I have this red dimes on my level 1 for my character to eat. It consists of 4 dimes but when my character eat all the dimes at once on level 1, i dont have the dimes appearing on the next level. pls help me!!
sharifahhilwa sharifahhilwa

2014/9/10

#
the code in my road world for the dimes
 
    /**
     * Prepare the world for the start of the program. That is; create the initial
     * objects and add them to the world.
     */
    private void prepare()
    {
        
        addObject(counters, 100,4);

        Gold gold = new Gold();
        addObject(gold, 65, 18);
        Gold gold2 = new Gold();
        addObject(gold2, 89, 25);
        Gold gold3 = new Gold();
        addObject(gold3, 70, 50);
        Gold gold4 = new Gold();
        addObject(gold4, 90, 80);
    }
}
danpost danpost

2014/9/10

#
How you change levels will influence how you add the dimes into the next level. Please show the code where you detect the conditions to change levels and the block of code that changes the level.
sharifahhilwa sharifahhilwa

2014/9/10

#
@danpost my leevel codes
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
import java.awt.Font;
/**
 * Write a description of class LevelCounter here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class LevelCounter extends Actor
{
 
    private GreenfootImage levelBoard = new GreenfootImage (132, 40);
    private Color backgroundColor = new Color (108, 108, 108);
    private Color textColor = new Color (255,216,0);
    private Font textFont = new Font ("Arial", Font.BOLD, 25);

    public LevelCounter ()
    {
        levelBoard.setColor (backgroundColor);
        levelBoard.setFont (textFont);
        levelBoard.fill();
        this.setImage (levelBoard);
        setLevel (0);
    }

    public void setLevel (int level)
    {
        levelBoard.setColor (backgroundColor);
        levelBoard.fill();
        levelBoard.setColor (textColor);
        String s = "LEVEL " + level;
        levelBoard.drawString(s, 1, 32);
    }

    }    
sharifahhilwa sharifahhilwa

2014/9/10

#
like i want to make it like a loop kind of thing, like the same amt of dimes appear on the next level.
danpost danpost

2014/9/10

#
No. That code is for the actor that displays the Level number. It has nothing to do with detecting the conditions for changing levels and the block of code with it. What code do you have that checks to see if all dimes have been eaten? and what code do you have for when all dimes have been eaten?
You need to login to post a reply.