private void startButton_Click(object sender, EventArgs e) { //Moves to level screen LevelScreen LevelScreenForm = new LevelScreen(); LevelScreenForm.Show(); this.Hide(); }
public Adventure(int healthValue, int curLevel, LevelScreen formValue) { this.health = healthValue; this.floor = curLevel; this.levelForm = formValue; InitializeComponent(); //Set bitmap image dogImg1 = (Bitmap)rm.GetObject("Dog"); dogImg2 = (Bitmap)rm.GetObject("Dog2"); stairs = (Bitmap)rm.GetObject("Stairs"); //Determines stair's random location stairRanLocX = randomGen.Next(1, 15); stairRanLocY = randomGen.Next(1, 15); stair = new Rectangle(-32, -32, 32, 32); //Determines wall texture, placement int wallNum = randomGen.Next(0, 7); wallNumList = new int[60]; for (int a = 0; a < wallNumList.Length; a++) { wallNum = randomGen.Next(0, 7); wallNumList[a] = wallNum; } wallTextureList = new Bitmap[7]; for (int i = 0; i < wallTextureList.Length; i++) { wallTextureList[i] = (Bitmap)rm.GetObject("GrayWall" + i); } wallsToDraw = new Rectangle[60]; for (int j = 0; j < wallsToDraw.Length; j += 4) { wallsToDraw[j] = new Rectangle(x, 0, 32, 32); wallsToDraw[j + 1] = new Rectangle(480, x, 32, 32); wallsToDraw[j + 2] = new Rectangle(0, x, 32, 32); wallsToDraw[j + 3] = new Rectangle(x, 480, 32, 32); x += 32; wallsToDraw[2] = new Rectangle(480, 480, 32, 32); } //Determines enemy textures, placement, numbers enemyTextures = new Bitmap[3]; for (int k = 0; k < enemyTextures.Length; k++) { enemyTextures[k] = (Bitmap)rm.GetObject("Enemy" + k); } if (1 <= floor && floor <= 5) { enemyNum = randomGen.Next(1, 11); } if (6 <= floor && floor <= 10) { enemyNum = randomGen.Next(10, 21); } if (floor >= 11) { enemyNum = randomGen.Next(20, 31); } int enemyRanLocX = randomGen.Next(1, 15); int enemyRanLocY = randomGen.Next(1, 15); enemyLocs = new Rectangle[enemyNum]; for (int l = 0; l < enemyLocs.Length; l++) { enemyRanLocX = randomGen.Next(1, 15); enemyRanLocY = randomGen.Next(1, 15); enemyLocs[l] = new Rectangle(32 * enemyRanLocX, 32 * enemyRanLocY, 32, 32); } int eneNum = randomGen.Next(0, 3); eneNumList = new int[enemyNum]; for (int m = 0; m < eneNumList.Length; m++) { eneNum = randomGen.Next(0, 3); eneNumList[m] = eneNum; } //Determines food texture, location, numbers foodPics = new Bitmap[21]; for (int n = 0; n < foodPics.Length; n++) { foodPics[n] = (Bitmap)rm.GetObject("Food" + n); } foodAmount = randomGen.Next(1, 21); foodCount = foodAmount; int foodNum = randomGen.Next(0, 21); foodNumList = new int[foodAmount]; for (int z = 0; z < foodNumList.Length; z++) { foodNum = randomGen.Next(0, 21); foodNumList[z] = foodNum; } int foodRanLocX = randomGen.Next(1, 15); int foodRanLocY = randomGen.Next(1, 15); foodLocs = new Rectangle[foodAmount]; for (int n = 0; n < foodLocs.Length; n++) { foodRanLocX = randomGen.Next(1, 15); foodRanLocY = randomGen.Next(1, 15); foodLocs[n] = new Rectangle(32 * foodRanLocX, 32 * foodRanLocY, 32, 32); } //Sets up rectangle for Dog sprite int dogRanLocX = randomGen.Next(1, 15); int dogRanLocY = randomGen.Next(1, 15); DogSpr = new Rectangle(32 * dogRanLocX, 32 * dogRanLocY, 32, 32); //Sets health healthBar.Maximum = 1000; healthBar.Value += 1000; }