battleship j2me mobile game frank ng. approach installed j2me and eclipse to edit the java code...
TRANSCRIPT
Battleship
J2ME Mobile Game
Frank Ng
Approach
• Installed J2ME and Eclipse to edit the Java code• Learned J2ME/Java by looking at example code• Created a basic flowchart for basic functionality
– Corrected as I programmed– Once I had basic functionality, I would expand if there
is more time• Used the examples and the flowchart to create
Battleship– Networking example Socket client.java,
sender.java, server.java– Tilepuzzle example board.java
Flowchart
Start
Setup layout of ships
Choose player number (to be
server or client)
Is it your turn?
Guess a square, send guess
coordinates to opponent
Receive Hit message from
opponent?
Receive miss message from
opponent?
Color the square RED
myturnP = false;
All ships sunk?
Color the square BLUE
Display winner information
Finished
Received guess
coordinates?
Is the guess a MISS?
Is the guess a HIT?
Color board blue, and send message
that guess is a miss
Color board blue, and send message
that guess is a miss
NoNo
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Frank NgEE-194WIRProf. Chang
Screenshot – Setup of board
Screenshot – Finish Setup
Screenshot – Choose player
Screenshot – Start Playing
KeyWhite – Blank Square
Blue – Miss
Red – Hit
Grey – Ship
Screenshot – Game Finished
Conclusion
• Good overall learning experience– Learned from example– J2ME WTK– Java– Networking
Conclusion – Cont’d
• Could have implemented more functionality/aesthetics given more time– Create “explosions” when player gets a hit
• Also use other images for misses, ships, etc.
– Detect if player setup ALL of the ships– Make it easier to setup the ships– Notification when a connection has been made
between the client and server– etc.
Questions/Comments?