HTML گیم مثال
- پچھلے پیج کلوک شروع
- پائیدہ پیج گیم کینواس
ਸਿਰਫ ਐੱਚਟੀਐੱਮਐੱਲ ਅਤੇ ਜਾਵਾਸਕ੍ਰਿਪਟ ਦੀ ਵਰਤੋਂ ਨਾਲ ਗੇਮ ਵਿਕਸਿਤ ਕਰਨੇ ਸਿੱਖੋ。
ਰੈੱਡ ਚੌਕਟ ਨੂੰ ਚਲਾਉਣ ਲਈ ਬਟਨ ਦਬਾਓ:
ਇੱਕ ਉਦਾਹਰਣ ਕਰਕੇ ਦੇਖੋ
ਸਾਡੇ ਆਨਲਾਈਨ ਐਡੀਟਰ ਦੀ ਮਦਦ ਨਾਲ, ਤੁਸੀਂ ਕੋਡ ਸੰਪਾਦਤ ਕਰ ਸਕਦੇ ਹੋ ਅਤੇ ਬਾਅਦ ਵਿੱਚ ਬਟਨ 'ਤੇ ਕਲਿੱਕ ਕਰਕੇ ਨਤੀਜੇ ਦੇਖ ਸਕਦੇ ਹੋ。
ਇੱਕ ਉਦਾਹਰਣ
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); } }
- پچھلے پیج کلوک شروع
- پائیدہ پیج گیم کینواس