-3

I have this group project that requires us to modify this JavaScript "block-breaker" game by adding some elements in the game.

GAME (http://breakout.enclavegames.com/lesson10.html)

that needs to be modified with the following conditions :

  1. Change the color of each lines of brick to have different colors
  2. Add a bullet that can be shot once each you have 3 points (using spacebar or click), it decrease the point by 3
  3. Add a game state: start (press space/click to start)
  4. 1 brick respawning/reappear every 15 seconds
halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    How to modify... Save the file to your local machine then open the page file using an editor and modify the code. Sorry... can't help it. It's your group project for you to learn, not to ask other people to do the work for you. – Oscar Siauw Dec 10 '16 at 13:52
  • You question should be on a specific problem not some to-do list – Vinay Dec 10 '16 at 15:44
  • You can consider the instructions as an algorithm, then code your program in a way that meets those requirements. If you experience specific problems people here could take a look, but there is nothing to discuss about right now. – adr1Script Dec 10 '16 at 18:25

1 Answers1

0

Since this is source code for that game (view-source:http://breakout.enclavegames.com/lesson10.html) you need to understand what is what first. As far as I can see for 1:

  1. You need to modify: function drawBricks() {}

ctx.fillStyle = "#0095DD"; //this is that blue brick color:

You can say something like:

function getRandomColor() {
    var letters = '0123456789ABCDEF';
    var color = '#';
    for (var i = 0; i < 6; i++ ) {
        color += letters[Math.floor(Math.random() * 16)];
    }
    return color;
}

So your ctx.fillStyle will be: ctx.fillStyle = getRandomColor()

With that approach you need to understand how each function work and to modify/add methods according to that.

I have just give you example, you can do lot of stuff with this game since source code is pretty straight forward.

If you are looking for some copy/paste solution I would suggest that you remove your stack-overflow account.

pregmatch
  • 2,629
  • 6
  • 31
  • 68