Guest User

RandomLevel.java

a guest
Mar 21st, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. package com.doamax.game.level;
  2.  
  3. import java.util.Random;
  4.  
  5. public class RandomLevel extends Level
  6. {      
  7.      
  8.        private static final Random random = new Random();
  9.      
  10.        public RandomLevel(int width, int height)
  11.        {
  12.        super (width, height);
  13.        }
  14.      
  15.        protected void generateLevel()
  16.        {
  17.                for (int y=0; y<height; y++)
  18.                {
  19.                        for(int x= 0; x<width; x++)
  20.                        {
  21.                                tiles[x+y*width] = random.nextInt(4);
  22.                              
  23.                        }
  24.                }
  25.        }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment