/*GameTimer timer - Used to update the raindrop positions on the configured interval*/ private void GameTimer_Tick(object sender, EventArgs e) { RaindropBuilder raindropBuilder = new RaindropBuilder(); // Creating a new object of the RaindropBuilder class raindropBuilder.UpdateRaindrops(raindropCount, raindrops, this.Height, this.Width); // using the object created to call the UpdateRaindrops method to increment there vertical position RenderScreen(); // Calling the RenderScreen method to reload the screen with new raindrop positions }
/*RaindropManager method - Loading the raindrops original starting position once, Load the raindrops in the specified position*/ private void RaindropManager() { Graphics raindrop = this.CreateGraphics(); if (runOnceRaindrops) // Will calculate the raindrops start position for the starting of the game only once { runOnceRaindrops = false; RaindropBuilder raindropBuilder = new RaindropBuilder(); // Creating a new object of the RaindropBuilder class raindrops = raindropBuilder.RaindropManager(this.Width, raindrop); // using the object created to call the RaindropManager method to build and load the raindrops } Pen BluePen = new Pen(Color.Blue, 3); // Creating a new instance of the Pen object to use for the raindrop creation this.Show(); for (int i = 0; i < raindropCount; i++) { //Looping through all the raindrops that was created and loading them on screen raindrop.DrawEllipse(BluePen, raindrops[i, 0], raindrops[i, 1], 2, 5); // The DrawEllipse object is used to draw the raindrop shaped graphics } }