Category

PHP

HTML Canvas Coordinates

By | PHP | No Comments

Canvas Coordinates The HTML canvas is a two-dimensional grid. The upper-left corner of the canvas has the coordinates (0,0) In the previous chapter, you saw this method used: fillRect(0,0,100,65). This means: Start at the upper-left corner (0,0) and draw a 100×65 pixels rectangle.    

Read More

HTML Canvas Can Do ?

By | PHP | No Comments

HTML Canvas Can Draw Text Canvas can draw colorful text, with animation or without animation.   HTML Canvas Can Draw Graphics Canvas has great features for graphical data presentation with an imagery of graphs and charts. HTML Canvas Can be Animated Canvas objects can move. Everything is possible: from simple…

Read More

Add an object onto the game screen

By | PHP | No Comments

Add Object Make a component constructor, which lets you add components onto the¬†screen. The object constructor is called component, and we make our first component, called myGamePiece:   Source Code:¬† <!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…

Read More

Complete Game in HTML

By | PHP | No Comments

This is simple HTML game. Source Code: <!DOCTYPE html> <html> <head> <meta name=”viewport” content=”width=device-width, initial-scale=1.0″/> <style> canvas { border:1px solid blue; background-color: orange; } </style> </head> <body onload=”startGame()”> <script> var myGamePiece; var myObstacles = []; var myScore; function startGame() { myGamePiece = new component(30, 30, “red”, 10, 120); myGamePiece.gravity =…

Read More