1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-19 13:01:12 +02:00

add kontra game engine template

This commit is contained in:
Kushagra Gour
2018-07-29 02:39:06 +05:30
parent 7610153dbb
commit eb7732ccb5
3 changed files with 43 additions and 9 deletions

23
src/html5-logo.svg Executable file
View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="2000px"
height="2000px" viewBox="0 0 2000 2000" enable-background="new 0 0 2000 2000" xml:space="preserve">
<g id="Logo_artwork">
</g>
<g id="Guides_to_delete">
<g>
<polygon fill="#E34E26" points="352.732,1718.4 208.627,101.984 1791.373,101.984 1647.093,1718.528 999.615,1898.016 "/>
<polygon fill="#EF662A" points="1000,234.108 1000,1760.716 1523.565,1615.585 1646.918,234.108 "/>
<polygon fill="#FFFFFF" points="503.468,432.378 556.906,1031.897 1244.048,1031.897 1220.988,1289.041 999.744,1348.857
778.919,1289.128 764.155,1124.017 565.155,1124.017 593.611,1442.302 999.697,1555.086 1406.296,1442.302 1460.806,833.669
738.229,833.669 720.086,630.648 1478.168,630.648 1478.773,630.648 1496.532,432.378 "/>
<g>
<polygon fill="#EBEBEB" points="1000,432.378 503.468,432.378 556.906,1031.897 1000,1031.897 1000,833.669 738.229,833.669
720.086,630.648 1000,630.648 "/>
<polygon fill="#EBEBEB" points="1000,1348.771 999.744,1348.857 778.919,1289.128 764.155,1124.017 565.155,1124.017
593.611,1442.302 999.697,1555.086 1000,1555.001 "/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -10,15 +10,8 @@ export default [
img: 'react-logo.svg'
},
{
id: 'html5-canvas',
title: 'HTML5 Canvas',
lastUpdatedTime: Date.now(),
img: 'html5-logo.svg'
},
{
id: 'html5-canvas-game',
title: 'HTML5 Canvas Game',
lastUpdatedTime: Date.now(),
id: 'kontra-game-engine',
title: 'Kontra HTML5 Game Engine',
img: 'html5-logo.svg'
}
];

View File

@@ -0,0 +1,18 @@
{
"title": "Kontra HTML5 game engine template",
"html": " <canvas></canvas>",
"css": "",
"js":
"kontra.init();\n\nvar sprite = kontra.sprite({\n x: 100, // starting x,y position of the sprite\n y: 80,\n color: '#bad455', // fill color of the sprite rectangle\n width: 20, // width and height of the sprite rectangle\n height: 40,\n dx: 2, // move the sprite 2px to the right every frame\n});\n\nvar loop = kontra.gameLoop({ // create the main game loop\n update: function() { // update the game state\n sprite.update();\n\n // wrap the sprites position when it reaches\n // the edge of the screen\n if (sprite.x > kontra.canvas.width) {\n sprite.x = -sprite.width;\n }\n },\n render: function() { // render the game state\n sprite.render();\n }\n});\n\nloop.start(); // start the game",
"externalLibs": {
"js":
"https://unpkg.com/kontra@3.3.0/dist/core.js\nhttps://unpkg.com/kontra@3.3.0/dist/sprite.js\nhttps://unpkg.com/kontra@3.3.0/dist/gameLoop.js\nhttps://unpkg.com/kontra@3.3.0/dist/pointer.js",
"css": ""
},
"htmlMode": "html",
"cssMode": "css",
"jsMode": "js",
"sizes": ["33px", "33px", "calc(100% - 66px)"],
"mainSizes": [50, 50],
"layoutMode": 1
}