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

2019/6/9

My program won't open anymore.

rtrout rtrout

2019/6/9

#
My greenfoot file is a game of plants vs zombies and it all of a sudden just wouldn't let me open the file anymore. I can open up my other greenfoot programs but I can't open this one.
Super_Hippo Super_Hippo

2019/6/10

#
Is it showing in the taskbar or is nothing happening?
rtrout rtrout

2019/6/15

#
it shows in the taskbar but when I click on it, nothing happens
Super_Hippo Super_Hippo

2019/6/15

#
Close Greenfoot. Open the "project.greenfoot" file of your scenario with a text editor. The last two lines should look like this:
xPosition=<some number>
yPosition=<some number>
Remove those two lines, save the file and open it with Greenfoot.
rtrout rtrout

2019/6/15

#
thanks a million. also I'm creating a remake of plants vz zombies game and I want my plants to shoot at the zombies only when they're present in the same row. Right now I currently, can make the plants shoot but the bullets come out even when the zombies are not on the screen. do you know How i can get the bullets to shoot only when there is a zombie in the same row as the plant? this is my code
private void shootPeas(int timeInterval)
    {
        if (!getWorld().getObjects(Zombie.class).isEmpty())
        {
            long curTime  = System.currentTimeMillis();
            if (curTime >= lastAdded + timeInterval) //5000ms = 5s
            {
                lastAdded  = curTime;
                Pea pea = new Pea();
                World world = getWorld();
                world.addObject(pea, getX() + 28, getY() -11);
            }
        }
    }
You need to login to post a reply.