Feeding Frenzy Java curriculum design

Java implementation: Feeding Frenzy (team)
a, team members
often Yunpeng (Leader): Design (file) ranking status bar and part of the interface design, the background music design
Zhao Yu Hao: to achieve the main class, related method It designs and call
Lin laudable: definitions players and computer-controlled fish

Second, designed 
 by using Eclipse, Netbeans to design "Feeding Frenzy" this game to be familiar with and learn to use Eclipse, java professional courses to consolidate our knowledge while Netbeans software.

Third, demand analysis
1. required classes in game design;  
2. write the source files, debug and analyze the game, so that the program can successfully "up and running."

Fourth, the function realization
form background, listening window button
fish design: computer fish and fish lead
lead fish: follow the mouse, the keyboard may use
players fish: randomly generated on both sides of the form, coordinates of each fish and speed randomly generated, randomly added to the existing player interface fish
background music: the main interface to add a button to achieve the music on or off, there will be special sound effects after eating fish
Leaderboard: players can save their scores, in the end sort of high
collision detection: when a player fish and fish players collide, triggering isHit function, by comparing the images to determine whether the coordinates are overlapped collision
games fail: when the collision, if the computer grade fish than fish protagonist, the protagonist of death, the end of the game: or game time ends, the game ends
upgrade effect: when the score reaches a certain level, then change the level of the player fish, zoom
status bar: displays the current score, the picture can fish, fish protagonist of rank and other information in the interface; players can according to your preference position adjustment bar
challenge mode: to accelerate the rate of occurrence of fish
main function diagram:

Fifth, the program analyzes
the whole idea: start screen, login screen, the protagonist of fish, fish, computer, background music, charts, status bar.
Process by eight classes, divided into three packets: fish (Fish [1,2,3,4,5], MyFish), fishgame (FishGame), view (Music, PlayerInfo, RankView, Start, StartManager).
Also fish folder to store pictures and music with the required procedures.

UML 类图:

FishGame:
main categories: inherit JFrame window to load the picture began interface, inherits KeyListener, ActionListener, MouseMotionListener interfaces, while achieving the protagonist listens to the fish and the button with the mouse and keyboard.
1. Create almost all of the property, it is one of the most important of creation:

2. Create an array to store pictures protagonist fish and computer pictures of fish, the fish moving pictures by changes in the array and location of realization:

3. Design the main interface features:

4. After entering the game redraw lead fish, fish and recording the score lead, lead fish determined upgrade:

Start:
login screen: draw the background picture, calling the progress bar to load the default method:

RankView:
achieve rankings, leaderboards have also load your own background picture, by reading the stored List player in the collection of information displayed in the rankings.
Run the code and screenshots:

StartManager:
Show Status Bar

Background music:

Game tips:

Sixth, problems and solutions met
1. problem: the beginning in the design of the interface window appears when you add a new window, mouse listener can not be added to the components of the new window.
The solution: find the back of the listener method was defined himself in the same class, so the method of mouse listener needs to be rewritten, after solved.

但还会出现按钮不能立即在新窗口显示出来,有开和关两个按钮,当鼠标移过去时关按钮才会显示。
2.问题:音乐无法调用mp3格式
解决办法:添加了一个jar包,方法是通过百度学习的,之后就可以成功调用mp3格式的音乐了。
3.不足:在游戏时,状态栏不能改变为透明,当鱼运动到状态栏后面的区域时会出现不能看见鱼的情况。
七、小结
本项目把程序实现的每一个具体功能作为类,然后用类来构成对象。 优点是代码可重用、系统易扩展。  
通过使用多线程,程序设计者可以分别用不同的线程完成特定的行为,提高系统的运行效率。

Guess you like

Origin www.cnblogs.com/cyp-00-111/p/12171709.html