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

2012/6/5

Bee Mover

solo1512 solo1512

2012/6/5

#
Label Code:
private int count = 0;
    private int realTimeNum;
    private int Factor = 5;
    public Label(String text)
    {
        GreenfootImage img = new GreenfootImage(text.length()*20,40);
        img.drawString(text,20,40);
        setImage(img);
    }
    public void setText(String text)
    {
        GreenfootImage img = getImage();
        img.clear();
        img.drawString(text,20,40);
    }
    public void act() 
    {
        if(beeIsAlive())
        {
            count++;
            realTimeNum = count/Factor;
        }
        setText("count."+realTimeNum);
    }
Bumble Bee code
public bumbelBee(Label label)
    {
        myLabel = label;
    }
World Code
Label label = new Label("Count: 0");
        addObject(label,84,763);
        bumbelBee bumbelBee = new bumbelBee(label);
        addObject(bumbelBee,200,250);
This is the code for the score. They are all essential.
SiggyxLeGiiT SiggyxLeGiiT

2012/6/5

#
Thank you for posting this :)
solo1512 solo1512

2012/6/5

#
Oh yeah! check out my friends game! It's called Stewie and Homer, it was made by JayWood860. He helped me with this game. Though this is a lot simpler.
SiggyxLeGiiT SiggyxLeGiiT

2012/6/5

#
Will do. Question:
public class mover extends Actor
{    
    public void ball(Label label)  
    {  
        myLabel = label;  
    } 
    public void act() 
    {
*This isn't all of the code obviously, just a snippet gives me this error: cannot find symbol - variable myLabel. Where did you declare it?
solo1512 solo1512

2012/6/5

#
public class bumbelBee extends Actor
{
    private int movement = 10;
    private Label myLabel;
    public int count;
    public bumbelBee(Label label)
    {
        myLabel = label;
    }
Where did you get the mover class? did you mean bumblebee? Cuz here's the code for that.
SiggyxLeGiiT SiggyxLeGiiT

2012/6/5

#
mover class is mine, I was changing it to fit mine because I don't have a bumblebee
solo1512 solo1512

2012/6/5

#
Oh!
SiggyxLeGiiT SiggyxLeGiiT

2012/6/5

#
Got it to work, thank you for making it simple! :)
solo1512 solo1512

2012/6/5

#
Once again, no prob. Play my games, I need views and advice. Stewie and Homer by JayWood860 as well! don't forget.
You need to login to post a reply.