హ్ట్మ్ల్ గేమ్ ఇన్స్టాన్స్

మాత్రమే HTML మరియు JavaScript ఉపయోగించి గేమ్స్ అభివృద్ధి నేర్చుకోండి.

ఎరుపు కట్టును కదిలించడానికి బటన్ ను నొక్కండి:






ప్రతిస్పందన ప్రయత్నించండి

మా ఆన్లైన్ ఎడిటర్ నియమించడం ద్వారా, మీరు కోడ్ ను సవరించవచ్చు మరియు బటన్ ను క్లిక్ చేసి ఫలితాలను చూడవచ్చు.

ప్రతిస్పందన

function startGame() {
  myGamePiece = new component(30, 30, "red", 10, 120);
  myGamePiece.gravity = 0.05;
  myScore = new component("30px", "Consolas", "black", 280, 40, "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;
  },
  clear : function() {
    this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
  }
}

亲自试一试