Space Shooter - Code
In this code, it i set for boundaries to make the ship not go out of the cameras view and that all players can see it all times making it easier to play.
Furthermore, the code was made so it was easy to understand for everyone. I never had nay problem with this code and I was comfortable coding this.
Next, i made movement for player 1 as the arrow keys so that the 2 players had different movement so they could play together on one keyboard. Furthermore the ship speed is determined on the direction it faces and it doesn't matter what way it goes as it would do the same and cap at a certain speed. I had no problems with this part of the code as I found it simple for me and I didn't need any help with it.
This code, defines the variables for player 1. It sets the values for the room as x and y and will only allow for it to be in a zone. Each ship has 3 lives and after they die 3 times the other player wins the game. The score is kept on track for everyone so they can see who is winning and who is loosing. Finally, the ship speed is set to 7 so they don't go extremely fast or too slow on the screen.
This is the shooting code that is used for both the ships and they have their own values. It makes the ship face the way it is moving. I have also made the bullet come out of the gun holes that were made on the ships. Finally, every time the collides with an arrow or a bullet it will then give the player money. Furthermore, i have made it so the
To continue, the next part is about the player 2. I have set the movement for it to be used as the mouse so it is easier for one of the players to use the keyboard. For the shooting code, each one of them have the same shot speed and will be going wherever the mouse is. However, I had a problem where the shots would be a heat seeker to the other ship and it became impossible for the other player to kill player 2. I also had the missiles to have the same fire rate as the first one and it was impossible to doge them. The thing I would change is the fire rate and to make the mouse more difficult to control. Other than that, it is playable.
Next, i made movement for player 1 as the arrow keys so that the 2 players had different movement so they could play together on one keyboard. Furthermore the ship speed is determined on the direction it faces and it doesn't matter what way it goes as it would do the same and cap at a certain speed. I had no problems with this part of the code as I found it simple for me and I didn't need any help with it.
This code, defines the variables for player 1. It sets the values for the room as x and y and will only allow for it to be in a zone. Each ship has 3 lives and after they die 3 times the other player wins the game. The score is kept on track for everyone so they can see who is winning and who is loosing. Finally, the ship speed is set to 7 so they don't go extremely fast or too slow on the screen.
This is the shooting code that is used for both the ships and they have their own values. It makes the ship face the way it is moving. I have also made the bullet come out of the gun holes that were made on the ships. Finally, every time the collides with an arrow or a bullet it will then give the player money. Furthermore, i have made it so the
To continue, the next part is about the player 2. I have set the movement for it to be used as the mouse so it is easier for one of the players to use the keyboard. For the shooting code, each one of them have the same shot speed and will be going wherever the mouse is. However, I had a problem where the shots would be a heat seeker to the other ship and it became impossible for the other player to kill player 2. I also had the missiles to have the same fire rate as the first one and it was impossible to doge them. The thing I would change is the fire rate and to make the mouse more difficult to control. Other than that, it is playable.






Comments
Post a Comment