Hey guys, so i have this project due on the 13th of Dec. I have been trying to work on it but im at a roadblock pretty early on and im just at a loss as to what to do, so i would appreciate a ton if you guys an provide some help :)
I am to make a program that is a game and is a pirate ship game. The ships are to start randomly in a 10x10 playing board (made with an array) and are to have four attributes [Movement (how many spaces a hip can move in one turn),Armor (how much damage it can take before being killed), Weapon (how strong the weapon is), and Range (how far can it shoot)].
What i need help on now is i think moving (before i get the attributes done), i would like to make it so the user enters where he wants to move (W for up, D for right, and A for left, NOT DOWN. Eventually this would be affected by the movement attribute so the user only has a certain amount of moves per turn.
But yeah, im at a loss guys and my teacher is very bad at helping me because he is way too vague and my classmates are all having trouble too. This project is a huge chunk of my grade so im pretty stressed out about it :(
To start with, are you limited to what C++ features you can use? Are you allowed to use classes? You also need to answer a couple of questions to determine how to handle things:
1. What should happen if a ship can move 3 spaces, but only two are available before hitting the edge of the game board? Should the ship move the maximum allowed spaces or reenter the movement command?
2. Same applies to attack range, what should happen? Can I overshoot?
3. Is the player playing against AI or another player or either or? This heavily determines the design. If for example its against a computer, you'll need some dumbed down AI. Just an example: When the computer selects its random target, if it makes a direct hit, should it start firing around the struck element similar to battleship where ships have a length on the grid? or should it continue to attack that element or seek the new location semi-intelligently?
Well i can't believe I added that sorry, well i am only supposed to use functions, arrays, loops, and decisions. Including all the basic c++ things like variable types etc. No classes though.
And to answer your questions:
1. Ship moves the maximum amount of spaces.
2. As long as the ship is in the range of your shot, it gets hit.
3. The player is against a single computer ship whose attributes are determined randomly and moves randomly until it comes close within 5 spaces of the players ship. The computer ship fires randomly though, if it hits the player, it continues to fire randomly (i know this is weird but its what my teacher told me)
4. The max amount of points per attribute is 6, and a maximum of 15 points of attributes in total.
5. The ships here have only one point of length just in case, the players ship only takes one space in the 10x10 grid, same goes for the computers ship.
6. The ships are to fire only to the left or right, not to the front or back.
Well that sucks, would be a lot cleaner with classes. So for ship movement are you concerned with ship collisions? And if so what happens?
When the user enters up, down, left, or right, are they prompted to enter the number of spaces to move or will it always move whatever their movement speed is? Need to clear these questions up before presenting some options for you.
2. As long as the ship is in the range of your shot, it gets hit.
Are you saying if my range is 4, and the ship is 2 elements away and I fire the maximum I'm still going to hit the enemy ship?
3. The player is against a single computer ship whose attributes are determined randomly and moves randomly until it comes close within 5 spaces of the players ship. The computer ship fires randomly though, if it hits the player, it continues to fire randomly (i know this is weird but its what my teacher told me)
Why are they determined randomly as the ship approaches? Why not just at the beginning of the game. This isn't a game programming class is it? Just intro to c++?
Also something to think about, if the ship is completely random, you'll need to safeguard it from scuttling itself by randomly targeting its location. I also wouldn't recommend you loop through the game board to find locations and targets, just have a variable that stores the players location and ai location and compare with movement and targets.... again this would be much cleaner with classes and your professor is an idiot.... :)
Each Frigate can move left, right, straight or not at all. It can't move diagonally or backwards. It can only move in the direction it is facing (N, S, E, W). Each frigate can fire only to the right or to the left of the direction it is facing. (E.g. if facing North, the ship can shoot east or west only)
Each turn the user gets to put in a sequence of actions equal to the number of actions their ship has available. All the actions are entered one after another for the user, and then the computer calculates its turn (up to the number of actions it has). Each ship then takes an action starting at the top of its list of actions, one action at a time. Order (or who goes first each for each segment of the turn) is determined randomly. When a ship fires, it can hit the other ship if the number of squares (starting with the square in front of the ship) counting to the square the opponents ship is in, is less than or equal to the range of their weapon. It does damage to the opposing ships armor equal to the count of the range of the weapon. If during any turn, any ship’s armor is equal to or less than zero, it is disabled and can no longer move forward, it may only turn in place.
...This is the instructions he gave us in a word document.
Also, to answer the second question, yes, if the ship is 2 elements away and the range of the ship firing is 4, then the ship that is 2 elements away gets shot.
As to the attributes, they are determined randomly for the computers ship at the beginning of the game, not every turn. And for the players ship, the player chooses the attribute points to assign his ship at the beginning of the game as well.
And no its not a game programming class, this is plain old intro to c++ :(