Friday, 15 May 2015

javascript - HTML5 Canvas Text not appearing? -


I know this is a frequently asked question, but I am very confused why my code is not working This is for my Bela where I have problems. The main problem is found on lines 85-87 where it is not displayed.

  ctx.fillStyle = "white"; Ctx.font = '80pt Helvetica'; Ctx.fillText ("Hello World!", 100, 100);  

Good, you're updating, then render

For example:

  function draw () {Ctx.fillStyle = "black"; Ctx.fillRect (0, 0, canvas.Wind, canvas.high); If (gamestate) {ctx.fillStyle = "white"; Ctx.fillRect (player.x, player.a, player.method, player.height); Ctx.fillRect (ball.x, ball.y, ball.width, ball.height); } If (gameState === false) {// For example, for example, click here ctx.fillStyle = "White"; Ctx.font = "bold 16px aerial"; Ctx.fillText ("PONG", 100, 100); } // gamestate} The end of the ceremony game () {update (); to present(); } // ... function render () {ctx.clearRect (0, 0, canvas.width, canvas.height); Attract (); }  

Pro-tip: Also consider step-debugging. It is often useful with such situations.


No comments:

Post a Comment