This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

Opalelement
Opalelement presents ...

2008/11/20

Battleship

Battleship:)

To play:
1. Hit run
2. Place your ships anywhere in your grid. (double-click to rotate)
3. Click Start
4. Play!

It currently doesn't tell you when you win/lose, so if there are 17 red pegs on a grid then its all good:)

To come:
- Fix bug in rotation: If you place a ship out and then rotate it, it can go off the grid or over anohter ship
- Fix ghost spots on even-length ships: When you drag them out, the ghost spot can mess you up
- Fix the off-screen boats bug: Vertical boats can go off the bottom of the screen
- Make it look better (more graphically appealing)
- Tell you when you win
*DONE!* Code computer to know when it hits a boat and go around until it finds the rest of the ship -- "Smart Computer"

There are still bugs with the smart computer, such as if a spot is taken when they switch directions, etc. These will be sorted out later.

Note that the boat placement issues are Player-Only issues. These have been sorted through the computer's code as they have specific rules. Player controlled actions can get around this though.

Any other bugs/suggestions will be put here as they are found.

7839 views / 10 in the last 7 days

3 votes | 0 in the last 7 days

Tags: game codepoint-08-school-16+ battleship hit miss ship battle

Your browser does not support the canvas tag.
OpalelementOpalelement

2008/11/24

Minor change which condensed code and prepared it for the "smart" computer. I will be working on it tomorrow and during that itme I should fix the following: - Fix bug in rotation: If you place a ship out and then rotate it, it can go off the grid or over anohter ship - Fix ghost spots on even-length ships: When you drag them out, the ghost spot can mess you up - Fix the off-screen boats bug: Vertical boats can go off the bottom of the screen And get a considerable amount done on "smart computer"
A new version of this scenario was uploaded on Mon Nov 24 03:02:01 UTC 2008
A new version of this scenario was uploaded on Thu Nov 27 05:28:33 UTC 2008
A new version of this scenario was uploaded on Thu Nov 27 05:37:29 UTC 2008
A new version of this scenario was uploaded on Thu Nov 27 05:45:20 UTC 2008
OpalelementOpalelement

2008/11/27

Computer now works, uploaded 3 times for these resons: 1. First smart computer release 2. Changed two numbers and two comparison operators that were causing out-of-bounds numbers for smart computer 3. Changed image for the game on GFG and reenabled collision checking (still basic) when dragging ships at the beginning Smart computer still has some bugs like if the spot it wants is taken then it picks a random spot instead of trying a different direction.
A new version of this scenario was uploaded on Thu Nov 27 21:03:29 UTC 2008
OpalelementOpalelement

2008/11/27

Fixed a minor bug in computer ships - I changed stuff and never changed it back, menaing the battleship could intersect the patrol boat (which seemed to happen alot)
wimeywimey

2009/5/3

Hi, I like it! Could you send me the source of this scenario??
fcronnie10fcronnie10

2014/11/8

hi :) it looks great, I am doing this game for school project. I need your help !!

See all comments

Want to leave a comment? You must first log in.

Who likes this?

Moritz wimey polle