Help me find the hidden word (score) in JavaScript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help me find the hidden word (score) in JavaScript

myScore = new component("24pt", "hoge,impact", "black", 30, 50, "text"); I could change the font, to "hoge,impact" but just can't figure out where the word Score (that shows in the game) is written in the code. Can anyone please explain? I'd like to change it to Spanish "Marcador" (if you Spanish speakers agree that that's the best word, off course) For context: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <style> canvas { border:1px solid #d3d3d3; background-color: #f1f1f1; } </style> </head> <body onload="startGame()"> <script> var myGamePiece; var myObstacles = []; var myScore; function startGame() { myGamePiece = new component(30, 30, "red", 30, 120); myScore = new component("24pt", "hoge,impact", "black", 30, 50, "text"); myGameArea.start(); } var myGameArea = { canvas : document.createElement("canvas"), start : function() { this.canvas.width = 480; this.canvas.height = 270; this.context = this.canvas.getContext("2d"); document.body.insertBefore(this.canvas, document.body.childNodes[0]); this.frameNo = 0; this.interval = setInterval(updateGameArea, 10); }, clear : function() { this.context.clearRect(5, 0, this.canvas.width, this.canvas.height); }, stop : function() { clearInterval(this.interval); } } function component(width, height, color, x, y, type) { this.type = type; this.width = width; this.height = height; this.speedX = 0; this.speedY = 0; this.x = x; this.y = y; this.update = function() { ctx = myGameArea.context; if (this.type == "text") { ctx.font = this.width + " " + this.height; ctx.fillStyle = color; ctx.fillText(this.text, this.x, this.y); } else { ctx.fillStyle = color; ctx.fillRect(this.x, this.y, this.width, this.height); }

12th Nov 2017, 12:36 AM
Andrea S
Andrea S - avatar
2 Answers
+ 1
Thank you, David. It wasn't so easy to post the entire code because of the word limit, but I found it. So problem solved.
14th Nov 2017, 5:41 AM
Andrea S
Andrea S - avatar
0
Your question does not contain all the code. Can you paste the entire code in a CodePlayground and post that link here?
12th Nov 2017, 2:45 AM
David Carroll
David Carroll - avatar