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

2013/5/15

Randomly generated dungeon

2
3
4
5
thssfrnssssmnt thssfrnssssmnt

2013/5/19

#
"You need to increase the size of the array to increase the size of your created world" u cretin
danpost danpost

2013/5/19

#
Right now, you are using an array that is in size, which should create a world size of 90x150. Add more zeros to each sub-array, and add more sub-arrays to your 2-d array.
henrYoda henrYoda

2013/5/19

#
Whoops, sorry @danpost, I didn't see that, as thssfrnssssmnt loves to write unecessary comments. Thank you for your help :)
henrYoda henrYoda

2013/5/19

#
ok @danpost, my world is now bigger. But even if I put a "1" in the center of my array, it appears in the bottom left corner. What should I do? my game class(The only one that was modified):
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class game here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class game extends MainWorldClass
{
    static int[][] myTwoDArray = {  
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},  
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},  
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},  
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
            };  

        //gets height of a 2D array (it equals 3)  
        int height = myTwoDArray.length;  

        //gets width of a 2D array (it equals 5)  
        int width = myTwoDArray[0].length;  
    /**
     * Constructor for objects of class game.
     * 
     */
    public game()
    {    
        super(myTwoDArray);
        
        
        
    }
}
thssfrnssssmnt thssfrnssssmnt

2013/5/19

#
ur for loops look like a monkey made them, thats the problem
danpost danpost

2013/5/19

#
I cannot say why it is appearing there; but I did notice one thing. In the last line of your MainWorldClass code, swap the 'i' and 'j': This will not solve your problem, if what you wrote was accurate.
thssfrnssssmnt thssfrnssssmnt

2013/5/19

#
thats it put them at the top right
henrYoda henrYoda

2013/5/19

#
@danpost Actually, what you showed me did work now. Thanks!
You need to login to post a reply.
2
3
4
5