Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

Game Frame

0 (0 Likes / 0 Dislikes)
Making the Game Frame Add a JPanel container in the JFrame. Create the class GameFrame. Then add this to the frame. The GameFrame class must extend to JPanel class and implement ActionListener Create a constructor in the GameFrame class. A constructor allows you to provide initial values for class fields when you create the object. Inside it, create the player object and put an initial position to it. Code the necessary variables for the game. Create the player variable from the Player class (which will be discussed later or on the next video). The following are the ArrayList or container for the enemies and other elements that come down. Set all the initial values for the class. Create a paint method that will draw all the necessary graphics for the game. Customize what will appear at certain levels. Do not forget to draw the player in the panel. The for loop is used to show how many objects will appear in the screen according the the size of the array. Create the following setters and getters for the arrays declared above. Create the startGame method inside the GameFrame class. What you code inside this method determines the number of enemies, power ups and power downs that will appear. It uses for loop so the number of the object will continuously increment according to the player's level. Create a checkEnd method. This is where you will code everything that happens when all the enemies are cleared by the player. Create a playAgain method. Insert here the necessary codes to hide the current frame and show another frame for showing the score. This includes stopping the timer, hiding the current frame then showing another frame for the scoring. Be detailed in coding the startGame method since it contains the number of object that falls and its boundaries or position.

Video Details

Duration: 3 minutes and 33 seconds
Country:
Language: English
License: Dotsub - Standard License
Genre: None
Views: 0
Posted by: c.ibasco on Mar 20, 2018

Caption and Translate

    Sign In/Register for Dotsub to translate this video.