wav files are best they are smaller in size, run method just start playing music and int in parentheses is used to tell how much time should player wait to replay music. You can make it support by using some extensions but for this type of games.
wav with it also java dosen’t support mp3 files so make sure to download wav files. It just generates the sound I have used ArrayList so if anyone wants more than 1 background music to play just put the file name in String with. It also have a highscore method which will load high score from the score text file. Menu: This class contains render method which will render graphics of PLAY, HELP, QUIT, BACK. In this class there are functions of boolean which will return true or false I have made functions of veticalcollision, leftcollision, rightcollision and stairscollision and floors collision you can also move to floor through stairs, it has some bugs now you may remove it if you want but I will fix it soon.
enemydeaths method have multiple condition which will check that if enemy is dead so this may happen if player is dead so this may happen. There is also a savescore method which just saves your current score. In controller class constructor I have made 5 object of enemies class in a method called addenemy and in addenemy method we have added enemies class object into a LinkedList called e which can contain multiple enemies class objects in result you get as many enemies as you want by just creating enemies class object in controller’s constructor. This class contains LinkedList of enemies class through which multiple enemies can spawn easily we do not have to create separate classes to generate multiple enemies, because controller class constructor all the enemies class info in it because all enemies have same images which makes it even more easy. It contains animation method which contains many conditions which will tell the player which animation to run when. It has enemy’s position, animation method to run enemy animation and reset method which will reset your position before player revive again. It has player’s position and I have made left right up and down bounds with Rectangle components and it has keyinputs. There is nothing much on frames and JPanel the rest of the work is done in 8 classes. I have used 1 JFrame called frame and 1 JPanel called gamescreen, I have gamescreen to frame so we can get our graphics. Things I have Done In Project: For Forms:
You can get this project from the link given below or click on Wreck-It Ralph image. It doesn’t need parallaxing effect because as I said before it’s a small game but one can make more levels or something. Hola people! since wreck it ralph 2 is releasing soon and by the trailer it looks great, so I have decided to make a small game of it, the game is not that much great but it’s good for learn platformer game.