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

2018/4/21

Make things come out!!

Heet_Patel Heet_Patel

2018/4/21

#
Okay so basically you guys have helped me with making things come out of an actor. But now i need something to come out of the world at random times in random places. I have the prepare act already and i will send the code which i already have.
Heet_Patel Heet_Patel

2018/4/21

#
This is the current code i have for the world. The ctor i want to spawn is called Fish
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Water here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Water extends World
{

    /**
     * Constructor for objects of class Water.
     * 
     */
    public Water()
    {    
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(1000, 700, 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()
    {
        Shark shark = new Shark();
        addObject(shark,847,83);  
    }
}

Heet_Patel Heet_Patel

2018/4/21

#
Actualy its okay
Heet_Patel Heet_Patel

2018/4/21

#
dont bother
You need to login to post a reply.