| 434 | |
| 435 | //for drawing |
| 436 | function draw() |
| 437 | { |
| 438 | let color = ctx.createLinearGradient(0,0,cvs.width,cvs.height); |
| 439 | color.addColorStop(0,"cyan");//0% |
| 440 | color.addColorStop(0.5,"deepskyblue");//50% |
| 441 | color.addColorStop(1,"cyan");//100% |
| 442 | ctx.fillStyle=color; //getContext method! |
| 443 | ctx.fillRect(0,0,cvs.clientWidth,cvs.height);// x axis, y axis,width,height! |
| 444 | cloud.draw(); |
| 445 | pipes.draw(); |
| 446 | ball.draw(); |
| 447 | ground.draw(); |
| 448 | bird.draw(); |
| 449 | getReady.draw(); |
| 450 | gameOver.draw(); |
| 451 | score.draw(); |
| 452 | |
| 453 | } |
| 454 | function update() |
| 455 | { |
| 456 | ground.update(); |