Adding text to javascript items -


is there way me add text sprites in javascript each can given it's own number instead of having edit picture?

i'm working simple matching game described here. have number shown, image resource must changed.

<!doctype html> <html>    <head>      <title>bakerice</title>     <meta charset="utf-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <script type ="text/javascript"     src ="simplegame.js"></script>     <script type="text/javascript">          var game;         var ic;         var ib;          function cone() {             tic = new sprite(game,"ice-cream-cone.png",150,150);             tic.setspeed(0);             tic.setboundaction(continue);             tic.setposition(200,400);              tic.checkdrag = function(){                 if(tic.ismousedown()){                     tic.setx(document.mousex);                     tic.sety(document.mousey);                 }             };              return tic;          }         function box(){             tib = new sprite(game,"ice-cream-box.png",200,200);             tib.setspeed(0);             tib.setboundaction(continue);             tib.setposition(400,250);             tib.addtext = function(text){                 var text = text;             };             return tib;         }         function init() {             console.log("begin init");             game = new scene();              ic = new cone();             ic.checkdrag();             ib = new box();             ib.addtext(1/2);             game.setbg("orange");             game.start();             console.log("end init");         }         function update() {             // console.log("begin update");              game.clear();             ib.update();             ic.update();             ic.checkdrag();              // console.log("end update");         }      </script>  </head> <body onload = "init()">  </body> 


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -