Hello everybody,
For school we need to make a game with Greenfoot, Chain Factor. To understand what game we are talking about here is a link to play the game. http://jayisgames.com/games/chain-factor/. We have some problems making the game. We need to have fifteen balls in the world but the balls can't lay on top of each other but they lay underneath each other on the bottom row. Does anyone know how to get the balls on the other layers as well?
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class speelVeld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class speelVeld extends World
{
/**
* Constructor for objects of class speelVeld.
*
*/
public speelVeld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(7, 7, 60);
for (int i = 0; i < 15; i++) {
int nummer = Greenfoot.getRandomNumber(9);
if (nummer == 0) {
int x = Greenfoot.getRandomNumber(8);
addObject(new one(), x, 6);
}
if (nummer == 1) {
int x = Greenfoot.getRandomNumber(8);
addObject(new two(), x, 6);
}
if (nummer == 2) {
int x = Greenfoot.getRandomNumber(8);
addObject(new three(), x, 6);
}
if (nummer == 3) {
int x = Greenfoot.getRandomNumber(8);
addObject(new four(), x, 6);
}
if (nummer == 4) {
int x = Greenfoot.getRandomNumber(8);
addObject(new five(), x, 6);
}
if (nummer == 5) {
int x = Greenfoot.getRandomNumber(8);
addObject(new six(), x, 6);
}
if (nummer == 6) {
int x = Greenfoot.getRandomNumber(8);
addObject(new seven(), x, 6);
}
if (nummer == 7) {
int x = Greenfoot.getRandomNumber(8);
addObject(new grijs(), x, 6);
}
if (nummer == 8) {
int x = Greenfoot.getRandomNumber(8);
addObject(new cracked(), x, 6);
}
}
}
}
