Jump to content
  • Advertisement
Sign in to follow this  
rexTroianus

My C++ Ships game

This topic is 4831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, Here is my second C++ game, Ships (my first game was TicTacToe). The game still has some bugs, which will be fixed soon, but the first version is here. Source code is included, but its not commented so you probably won't understand too much. But please, comment the game in general, report bugs and stuff. Download Ships Thank you, RexTroianus

Share this post


Link to post
Share on other sites
Advertisement
You need to check if the player is placing any ships on already occupied locations, since I placed all 4 ships on (3,6) without problems.

Other than that, good job!

Toolmaker

Share this post


Link to post
Share on other sites
Yes, I know about that problem.

Also, there is a problem when choosing target location. You can input (100,232) and it will tell you missed.

Thanks for trying it! ;) I expect more comments from other guys...

RexTroianus

Share this post


Link to post
Share on other sites
also check to make sure that the x and y coords that the player inputs, is within the board dimensions. I accidentally put in 55 and it just calculated a miss.

But good job. I like how it shows the board every time with a M in the spot that was fired at and missed.

Share this post


Link to post
Share on other sites
I've just taken a fast look over your code:

This is only in so far c++, as you use std::cout and std::cin...

I for myself what call this C and not C++...

So what you should do:

- get rid of your global variables, they are bet style...
especially loop counters should be declared in as small a scop as possible.
- try to put your functions in and variables in classes
- and even with such a small Program start to put the code in more than one file.

I hope this helps a little, just keep going ;-)

Share this post


Link to post
Share on other sites
Yeah, I know about that bug, as I said already (in Instructions and in my second post)...

I already fixed the bugs. I will upload the final version soon!

Please post more comments and suggestions!

Thank you,
RexTroianus

Share this post


Link to post
Share on other sites
Quote:
Original post by philipptr
i was able to set all ships on one position and fire on a position out of screen... seems strange to me O_o


Yeah, I know about that bug, as I said already (in Instructions and in my second post)...

I already fixed the bugs. I will upload the final version soon!

Please post more comments and suggestions!

Thank you,
RexTroianus

Share this post


Link to post
Share on other sites
Quote:
Original post by Sparhawk42
I've just taken a fast look over your code:

This is only in so far c++, as you use std::cout and std::cin...

I for myself what call this C and not C++...

So what you should do:

- get rid of your global variables, they are bet style...
especially loop counters should be declared in as small a scop as possible.
- try to put your functions in and variables in classes
- and even with such a small Program start to put the code in more than one file.

I hope this helps a little, just keep going ;-)


Yeah, I was thinking about classes and more than just 1 file for this... Maybe in the next version, or next game... :) Thanks anyway! ;)

Share this post


Link to post
Share on other sites
Here's a bug I found. I just played 1 quick game and I lost. When I type 3 to exit it kept asking me to fire on the enemies remaining ships.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!