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

2019/6/28

please help me with my code i cant proced in my gamewithout it

1
2
danpost danpost

2019/6/28

#
Show Timer class codes. Also, show codes around that which creates a BlueDot object.
Coltz Coltz

2019/6/28

#
there is no code in the timer class
Coltz Coltz

2019/6/28

#
i also dont understand what you mean show the code that which creates a bluedot object
Coltz Coltz

2019/6/28

#
my idea was that thhis acts like a timer but is there a better way to do this
danpost danpost

2019/6/28

#
Show code of class where you have "new BlueDot()".
Coltz Coltz

2019/6/28

#
import greenfoot.*; /** * Write a description of class Level1Screen here. * * @author (your name) * @version (a version number or a date) */ public class Level1Screen extends World { /** * Constructor for objects of class Level1Screen. * */ public Level1Screen() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(800, 600, 1); prepare(); } /** * Prepare the world for the start of the program. That is: create the initial * objects and add them to the world. */ private void prepare() { BlueDot bluedot = new BlueDot(); addObject(bluedot, 1, 1); } }
danpost danpost

2019/6/28

#
Remove both the Timer and BlueDot classes from your project and use this:
import greenfoot.*;

public class Level1Screen extends World
{
    public Level1Screen()
    {
        super(800, 600, 1);
    }
    
    public void act()
    {
        Greenfoot.delay(60);
        Greenfoot.setWorld(new Test2());
    }
}
Coltz Coltz

2019/6/28

#
thank you
Reversatile Reversatile

2019/6/28

#
import greenfoot.*;
  
/**
 * Write a description of class BlueDot here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class BlueDot extends Timer
{
    /**
     * Act - do whatever the BlueDot wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act(ж)
    {
        Move();
        Timer();
    }    
      
    public void Move()
    {
        move(10);
    }
      
    public void Timer()
    {
        if(getX() == 69) 
        {
            Greenfoot.setWorld(new Test2());
            Сode Reversatile
        }
    }
}
You need to login to post a reply.
1
2