From 1c78c303e2b0a27b8a89a90c97170d8c2d223af8 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Mon, 6 May 2024 12:01:09 +0530 Subject: [PATCH] add kaboom --- src/assets/kaboom-logo.png | Bin 0 -> 4439 bytes src/libraryList.js | 5 +++++ src/templateList.js | 5 +++++ src/templates/template-kaboom.json | 18 ++++++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 src/assets/kaboom-logo.png create mode 100644 src/templates/template-kaboom.json diff --git a/src/assets/kaboom-logo.png b/src/assets/kaboom-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..4384ab749a7e3b72b719d5adeb09546fa94a4bc1 GIT binary patch literal 4439 zcmb7H2~<M5;^FYlb3ob!@-I{fFhH2?|-HFp5q z&j9AYDVr1kprWk-2TuSE)M4F$6aoqhSoh+SLk>-`wdJ(aD{CTi=KZ$%S0*S|5P6rn z?A%6LL$RZdCX6d3vR`t*e-5^73--x3Dmr8hRZI(1S-<)JmA1h0{d{=G#5NfQ08JP) z2NN;&LYk;Z>}JIuX_kmE^v8#CV8FiXS!qJ~5yZ8JUy@F`9j(ss1eG1$4*82oQ(UU~ zje}?y%>_#SAIK+pm!1yTHpWP@6IEdy0q`7TA#gh$`2+zx-m1lG9!WSF9!V)_!kkt~eMa8iQVUkCfJ=(6)Bz%Xn-5^|WsIf8flu@}a&kfho` z7Ped~YozLvj!sIgkeBpl$j^W+&3;zVIz(#~-5-6I6?uAPiB!xuFhLCNL zfIS;uopU{gY$8UP?l1qIX2njeKU-S(o|t7wio}@%DK|eT`NOgwk^3&b_e3T)*rMz0 z+NrKsHq_)u8+^DqAc3US=QcY+PTmdxuxlq0@pIp@ZWYDPSAaaus>bOu9~VBECfe=u zE2c5OR;5IclC*T6w*0l)QZZiD6p96&su0@%_wt&vyH6V82VnQYr!utfhrBPk?>1mvGyS*aM&uNL<*& z?jcA&)^|Q~74pNo$togoF4SAoM(GVhG}TyGK1dQs+f@9CEUr;sY>ozMo_)%te?D73 z37al+g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 0 HcmV?d00001 diff --git a/src/libraryList.js b/src/libraryList.js index 804953d..8f59781 100644 --- a/src/libraryList.js +++ b/src/libraryList.js @@ -98,6 +98,11 @@ export const jsLibs = [ url: 'https://cdn.tailwindcss.com/3.4.3', label: 'Tailwind 3', type: 'js' + }, + { + url: 'https://unpkg.com/kaboom@3000/dist/kaboom.js', + label: 'Kaboom', + type: 'js' } ]; export const cssLibs = [ diff --git a/src/templateList.js b/src/templateList.js index 2575f73..64de838 100644 --- a/src/templateList.js +++ b/src/templateList.js @@ -30,5 +30,10 @@ export default [ title: 'Kontra Game Engine', img: 'assets/html5-logo.svg', isFileModeSupported: true + }, + { + id: 'kaboom', + title: 'Kaboom', + img: 'assets/kaboom-logo.png' } ]; diff --git a/src/templates/template-kaboom.json b/src/templates/template-kaboom.json new file mode 100644 index 0000000..40ffa95 --- /dev/null +++ b/src/templates/template-kaboom.json @@ -0,0 +1,18 @@ +{ + "title": "Kaboom game engine template", + "content": "", + "html": "", + "css": "", + "js": "// Responding to gravity & jumping\n\n// Start kaboom\nkaboom()\n\n// Load assets\nloadSprite(\"bean\", \"https://kaboomjs.com/sprites/bean.png\")\n\n// Set the gravity acceleration (pixels per second)\nsetGravity(1600)\n\n// Add player game object\nconst player = add([\n\tsprite(\"bean\"),\n\tpos(center()),\n\tarea(),\n\t// body() component gives the ability to respond to gravity\n\tbody(),\n])\n\nonKeyPress(\"space\", () => {\n\t// .isGrounded() is provided by body()\n\tif (player.isGrounded()) {\n\t\t// .jump() is provided by body()\n\t\tplayer.jump()\n\t}\n})\n\n// .onGround() is provided by body(). It registers an event that runs whenever player hits the ground.\nplayer.onGround(() => {\n\tdebug.log(\"ouch\")\n})\n\n// Accelerate falling when player holding down arrow key\nonKeyDown(\"down\", () => {\n\tif (!player.isGrounded()) {\n\t\tplayer.vel.y += dt() * 1200\n\t}\n})\n\n// Jump higher if space is held\nonKeyDown(\"space\", () => {\n\tif (!player.isGrounded() && player.vel.y < 0) {\n\t\tplayer.vel.y -= dt() * 600\n\t}\n})\n\n// Add a platform to hold the player\nadd([\n\trect(width(), 48),\n\toutline(4),\n\tarea(),\n\tpos(0, height() - 48),\n\t// Give objects a body() component if you don't want other solid objects pass through\n\tbody({ isStatic: true }),\n])\n\nadd([\n\ttext(\"Press space key\", { width: width() / 2 }),\n\tpos(12, 12),\n])\n\n// Check out https://kaboomjs.com#BodyComp for everything body() provides\n", + "externalLibs": { + "js": "\nhttps://unpkg.com/kaboom@3000/dist/kaboom.js", + "css": "" + }, + "layoutMode": 1, + "htmlMode": "html", + "cssMode": "css", + "jsMode": "js", + + "mainSizes": [50, 50], + "sizes": ["33px", "33px", 100] +}