General Instructions:
Click on the link to open the
Starter file,
it contains images and some code to help you get started.
Now, click on the fork icon .
Then at the bottom it will give the option to fork the project to save and modify .
Add the code inside the highlighted box in the examples.
For making the spaceship move left of the screen, make a conditional statement. Use keyIsDown() and specify the key of your choice.
The x-axis of the spaceship is now used to move the ship to the left .
Similarly, for making the spaceship move right of the screen, make a conditional statement. Use keyIsDown() and specify the key of your choice.
The x-axis of the spaceship is now used to move the ship to the right .
Notice the spaceship is move out of the canvas as the key is pressed down for long.
Add bounds on the left side and the right side , so the spaceship does not move out of the canvas.
Make the asteroid move down incrementing the value of the y-axis of the asteroid.
Notice the asteroid after reching the bottom of the canvas just disappear and does not come back.
Make a conditional statement which checks if the y-axis of the asteroid is greater than the maximum
height of the canvas.
Reset the y-axis of the asteroid to the initial position which is -500.
Randomise the x-axis of the asteroid, so it starts to appear from different positions in the x-axis.
Randomise the size of the asteroid, so the shape of the asteroid keep changing.
Score variable is already present and the score board is also appearing but the score is not changing.
To fix this problem , find the code where the asteroid crossed the maximum height of the canvas ,
as that will make sure that it didn't hit the spaceship.
Increment the score by any value of your choice.
Happy Coding!!