diff --git a/public/Roll-a-ball/Build/Builds.asm.code.unityweb b/Roll-a-ball/Build/Builds.asm.code.unityweb similarity index 100% rename from public/Roll-a-ball/Build/Builds.asm.code.unityweb rename to Roll-a-ball/Build/Builds.asm.code.unityweb diff --git a/public/Roll-a-ball/Build/Builds.asm.framework.unityweb b/Roll-a-ball/Build/Builds.asm.framework.unityweb similarity index 100% rename from public/Roll-a-ball/Build/Builds.asm.framework.unityweb rename to Roll-a-ball/Build/Builds.asm.framework.unityweb diff --git a/public/Roll-a-ball/Build/Builds.asm.memory.unityweb b/Roll-a-ball/Build/Builds.asm.memory.unityweb similarity index 100% rename from public/Roll-a-ball/Build/Builds.asm.memory.unityweb rename to Roll-a-ball/Build/Builds.asm.memory.unityweb diff --git a/public/Roll-a-ball/Build/Builds.data.unityweb b/Roll-a-ball/Build/Builds.data.unityweb similarity index 100% rename from public/Roll-a-ball/Build/Builds.data.unityweb rename to Roll-a-ball/Build/Builds.data.unityweb diff --git a/public/Roll-a-ball/Build/Builds.json b/Roll-a-ball/Build/Builds.json similarity index 100% rename from public/Roll-a-ball/Build/Builds.json rename to Roll-a-ball/Build/Builds.json diff --git a/public/Roll-a-ball/Build/UnityLoader.js b/Roll-a-ball/Build/UnityLoader.js similarity index 100% rename from public/Roll-a-ball/Build/UnityLoader.js rename to Roll-a-ball/Build/UnityLoader.js diff --git a/public/Roll-a-ball/TemplateData/UnityProgress.js b/Roll-a-ball/TemplateData/UnityProgress.js similarity index 100% rename from public/Roll-a-ball/TemplateData/UnityProgress.js rename to Roll-a-ball/TemplateData/UnityProgress.js diff --git a/public/Roll-a-ball/TemplateData/favicon.ico b/Roll-a-ball/TemplateData/favicon.ico similarity index 100% rename from public/Roll-a-ball/TemplateData/favicon.ico rename to Roll-a-ball/TemplateData/favicon.ico diff --git a/public/Roll-a-ball/TemplateData/fullscreen.png b/Roll-a-ball/TemplateData/fullscreen.png similarity index 100% rename from public/Roll-a-ball/TemplateData/fullscreen.png rename to Roll-a-ball/TemplateData/fullscreen.png diff --git a/public/Roll-a-ball/TemplateData/progressEmpty.Dark.png b/Roll-a-ball/TemplateData/progressEmpty.Dark.png similarity index 100% rename from public/Roll-a-ball/TemplateData/progressEmpty.Dark.png rename to Roll-a-ball/TemplateData/progressEmpty.Dark.png diff --git a/public/Roll-a-ball/TemplateData/progressEmpty.Light.png b/Roll-a-ball/TemplateData/progressEmpty.Light.png similarity index 100% rename from public/Roll-a-ball/TemplateData/progressEmpty.Light.png rename to Roll-a-ball/TemplateData/progressEmpty.Light.png diff --git a/public/Roll-a-ball/TemplateData/progressFull.Dark.png b/Roll-a-ball/TemplateData/progressFull.Dark.png similarity index 100% rename from public/Roll-a-ball/TemplateData/progressFull.Dark.png rename to Roll-a-ball/TemplateData/progressFull.Dark.png diff --git a/public/Roll-a-ball/TemplateData/progressFull.Light.png b/Roll-a-ball/TemplateData/progressFull.Light.png similarity index 100% rename from public/Roll-a-ball/TemplateData/progressFull.Light.png rename to Roll-a-ball/TemplateData/progressFull.Light.png diff --git a/public/Roll-a-ball/TemplateData/progressLogo.Dark.png b/Roll-a-ball/TemplateData/progressLogo.Dark.png similarity index 100% rename from public/Roll-a-ball/TemplateData/progressLogo.Dark.png rename to Roll-a-ball/TemplateData/progressLogo.Dark.png diff --git a/public/Roll-a-ball/TemplateData/progressLogo.Light.png b/Roll-a-ball/TemplateData/progressLogo.Light.png similarity index 100% rename from public/Roll-a-ball/TemplateData/progressLogo.Light.png rename to Roll-a-ball/TemplateData/progressLogo.Light.png diff --git a/public/Roll-a-ball/TemplateData/style.css b/Roll-a-ball/TemplateData/style.css similarity index 100% rename from public/Roll-a-ball/TemplateData/style.css rename to Roll-a-ball/TemplateData/style.css diff --git a/public/Roll-a-ball/TemplateData/webgl-logo.png b/Roll-a-ball/TemplateData/webgl-logo.png similarity index 100% rename from public/Roll-a-ball/TemplateData/webgl-logo.png rename to Roll-a-ball/TemplateData/webgl-logo.png diff --git a/public/Roll-a-ball/index.html b/Roll-a-ball/index.html similarity index 100% rename from public/Roll-a-ball/index.html rename to Roll-a-ball/index.html diff --git a/public/Survival-shooter/Builds/Build/Builds.asm.code.unityweb b/Survival-shooter/Builds/Build/Builds.asm.code.unityweb similarity index 100% rename from public/Survival-shooter/Builds/Build/Builds.asm.code.unityweb rename to Survival-shooter/Builds/Build/Builds.asm.code.unityweb diff --git a/public/Survival-shooter/Builds/Build/Builds.asm.framework.unityweb b/Survival-shooter/Builds/Build/Builds.asm.framework.unityweb similarity index 100% rename from public/Survival-shooter/Builds/Build/Builds.asm.framework.unityweb rename to Survival-shooter/Builds/Build/Builds.asm.framework.unityweb diff --git a/public/Survival-shooter/Builds/Build/Builds.asm.memory.unityweb b/Survival-shooter/Builds/Build/Builds.asm.memory.unityweb similarity index 100% rename from public/Survival-shooter/Builds/Build/Builds.asm.memory.unityweb rename to Survival-shooter/Builds/Build/Builds.asm.memory.unityweb diff --git a/public/Survival-shooter/Builds/Build/Builds.data.unityweb b/Survival-shooter/Builds/Build/Builds.data.unityweb similarity index 100% rename from public/Survival-shooter/Builds/Build/Builds.data.unityweb rename to Survival-shooter/Builds/Build/Builds.data.unityweb diff --git a/public/Survival-shooter/Builds/Build/Builds.json b/Survival-shooter/Builds/Build/Builds.json similarity index 100% rename from public/Survival-shooter/Builds/Build/Builds.json rename to Survival-shooter/Builds/Build/Builds.json diff --git a/public/Survival-shooter/Builds/Build/UnityLoader.js b/Survival-shooter/Builds/Build/UnityLoader.js similarity index 100% rename from public/Survival-shooter/Builds/Build/UnityLoader.js rename to Survival-shooter/Builds/Build/UnityLoader.js diff --git a/public/Survival-shooter/Builds/TemplateData/UnityProgress.js b/Survival-shooter/Builds/TemplateData/UnityProgress.js similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/UnityProgress.js rename to Survival-shooter/Builds/TemplateData/UnityProgress.js diff --git a/public/Survival-shooter/Builds/TemplateData/favicon.ico b/Survival-shooter/Builds/TemplateData/favicon.ico similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/favicon.ico rename to Survival-shooter/Builds/TemplateData/favicon.ico diff --git a/public/Survival-shooter/Builds/TemplateData/fullscreen.png b/Survival-shooter/Builds/TemplateData/fullscreen.png similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/fullscreen.png rename to Survival-shooter/Builds/TemplateData/fullscreen.png diff --git a/public/Survival-shooter/Builds/TemplateData/progressEmpty.Dark.png b/Survival-shooter/Builds/TemplateData/progressEmpty.Dark.png similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/progressEmpty.Dark.png rename to Survival-shooter/Builds/TemplateData/progressEmpty.Dark.png diff --git a/public/Survival-shooter/Builds/TemplateData/progressEmpty.Light.png b/Survival-shooter/Builds/TemplateData/progressEmpty.Light.png similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/progressEmpty.Light.png rename to Survival-shooter/Builds/TemplateData/progressEmpty.Light.png diff --git a/public/Survival-shooter/Builds/TemplateData/progressFull.Dark.png b/Survival-shooter/Builds/TemplateData/progressFull.Dark.png similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/progressFull.Dark.png rename to Survival-shooter/Builds/TemplateData/progressFull.Dark.png diff --git a/public/Survival-shooter/Builds/TemplateData/progressFull.Light.png b/Survival-shooter/Builds/TemplateData/progressFull.Light.png similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/progressFull.Light.png rename to Survival-shooter/Builds/TemplateData/progressFull.Light.png diff --git a/public/Survival-shooter/Builds/TemplateData/progressLogo.Dark.png b/Survival-shooter/Builds/TemplateData/progressLogo.Dark.png similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/progressLogo.Dark.png rename to Survival-shooter/Builds/TemplateData/progressLogo.Dark.png diff --git a/public/Survival-shooter/Builds/TemplateData/progressLogo.Light.png b/Survival-shooter/Builds/TemplateData/progressLogo.Light.png similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/progressLogo.Light.png rename to Survival-shooter/Builds/TemplateData/progressLogo.Light.png diff --git a/public/Survival-shooter/Builds/TemplateData/style.css b/Survival-shooter/Builds/TemplateData/style.css similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/style.css rename to Survival-shooter/Builds/TemplateData/style.css diff --git a/public/Survival-shooter/Builds/TemplateData/webgl-logo.png b/Survival-shooter/Builds/TemplateData/webgl-logo.png similarity index 100% rename from public/Survival-shooter/Builds/TemplateData/webgl-logo.png rename to Survival-shooter/Builds/TemplateData/webgl-logo.png diff --git a/public/Survival-shooter/Builds/index.html b/Survival-shooter/Builds/index.html similarity index 100% rename from public/Survival-shooter/Builds/index.html rename to Survival-shooter/Builds/index.html diff --git a/public/phaser-harkat/.gitkeep b/phaser-harkat/.gitkeep similarity index 100% rename from public/phaser-harkat/.gitkeep rename to phaser-harkat/.gitkeep diff --git a/public/phaser-harkat/phaser-udemy/assets/backgrounds/sunset.png b/phaser-harkat/phaser-udemy/assets/backgrounds/sunset.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/backgrounds/sunset.png rename to phaser-harkat/phaser-udemy/assets/backgrounds/sunset.png diff --git a/public/phaser-harkat/phaser-udemy/assets/sounds/audio.mp3 b/phaser-harkat/phaser-udemy/assets/sounds/audio.mp3 similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/sounds/audio.mp3 rename to phaser-harkat/phaser-udemy/assets/sounds/audio.mp3 diff --git a/public/phaser-harkat/phaser-udemy/assets/sounds/audio.wav b/phaser-harkat/phaser-udemy/assets/sounds/audio.wav similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/sounds/audio.wav rename to phaser-harkat/phaser-udemy/assets/sounds/audio.wav diff --git a/public/phaser-harkat/phaser-udemy/assets/sprites/New Bitmap Image.bmp b/phaser-harkat/phaser-udemy/assets/sprites/New Bitmap Image.bmp similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/sprites/New Bitmap Image.bmp rename to phaser-harkat/phaser-udemy/assets/sprites/New Bitmap Image.bmp diff --git a/public/phaser-harkat/phaser-udemy/assets/sprites/armeija_apustus.png b/phaser-harkat/phaser-udemy/assets/sprites/armeija_apustus.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/sprites/armeija_apustus.png rename to phaser-harkat/phaser-udemy/assets/sprites/armeija_apustus.png diff --git a/public/phaser-harkat/phaser-udemy/assets/sprites/arrow.png b/phaser-harkat/phaser-udemy/assets/sprites/arrow.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/sprites/arrow.png rename to phaser-harkat/phaser-udemy/assets/sprites/arrow.png diff --git a/public/phaser-harkat/phaser-udemy/assets/sprites/rakenus_apustus.jpg b/phaser-harkat/phaser-udemy/assets/sprites/rakenus_apustus.jpg similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/sprites/rakenus_apustus.jpg rename to phaser-harkat/phaser-udemy/assets/sprites/rakenus_apustus.jpg diff --git a/public/phaser-harkat/phaser-udemy/assets/sprites/saber.png b/phaser-harkat/phaser-udemy/assets/sprites/saber.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/sprites/saber.png rename to phaser-harkat/phaser-udemy/assets/sprites/saber.png diff --git "a/public/phaser-harkat/phaser-udemy/assets/sprites/t\303\244r\303\244nt\303\244nk\303\266.jpg" "b/phaser-harkat/phaser-udemy/assets/sprites/t\303\244r\303\244nt\303\244nk\303\266.jpg" similarity index 100% rename from "public/phaser-harkat/phaser-udemy/assets/sprites/t\303\244r\303\244nt\303\244nk\303\266.jpg" rename to "phaser-harkat/phaser-udemy/assets/sprites/t\303\244r\303\244nt\303\244nk\303\266.jpg" diff --git a/public/phaser-harkat/phaser-udemy/assets/spritesheets/saberSheet.png b/phaser-harkat/phaser-udemy/assets/spritesheets/saberSheet.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/spritesheets/saberSheet.png rename to phaser-harkat/phaser-udemy/assets/spritesheets/saberSheet.png diff --git a/public/phaser-harkat/phaser-udemy/assets/tilemaps/grass.png b/phaser-harkat/phaser-udemy/assets/tilemaps/grass.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/tilemaps/grass.png rename to phaser-harkat/phaser-udemy/assets/tilemaps/grass.png diff --git a/public/phaser-harkat/phaser-udemy/assets/tilemaps/ground.png b/phaser-harkat/phaser-udemy/assets/tilemaps/ground.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/tilemaps/ground.png rename to phaser-harkat/phaser-udemy/assets/tilemaps/ground.png diff --git a/public/phaser-harkat/phaser-udemy/assets/tilemaps/lava.png b/phaser-harkat/phaser-udemy/assets/tilemaps/lava.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/tilemaps/lava.png rename to phaser-harkat/phaser-udemy/assets/tilemaps/lava.png diff --git a/public/phaser-harkat/phaser-udemy/assets/tilemaps/lavarock.png b/phaser-harkat/phaser-udemy/assets/tilemaps/lavarock.png similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/tilemaps/lavarock.png rename to phaser-harkat/phaser-udemy/assets/tilemaps/lavarock.png diff --git a/public/phaser-harkat/phaser-udemy/assets/tilemaps/state1Tilemap.json b/phaser-harkat/phaser-udemy/assets/tilemaps/state1Tilemap.json similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/tilemaps/state1Tilemap.json rename to phaser-harkat/phaser-udemy/assets/tilemaps/state1Tilemap.json diff --git a/public/phaser-harkat/phaser-udemy/assets/tilemaps/state1Tilemap.tmx b/phaser-harkat/phaser-udemy/assets/tilemaps/state1Tilemap.tmx similarity index 100% rename from public/phaser-harkat/phaser-udemy/assets/tilemaps/state1Tilemap.tmx rename to phaser-harkat/phaser-udemy/assets/tilemaps/state1Tilemap.tmx diff --git a/public/phaser-harkat/phaser-udemy/index.html b/phaser-harkat/phaser-udemy/index.html similarity index 100% rename from public/phaser-harkat/phaser-udemy/index.html rename to phaser-harkat/phaser-udemy/index.html diff --git a/public/phaser-harkat/phaser-udemy/main.js b/phaser-harkat/phaser-udemy/main.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/main.js rename to phaser-harkat/phaser-udemy/main.js diff --git a/public/phaser-harkat/phaser-udemy/state0.js b/phaser-harkat/phaser-udemy/state0.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state0.js rename to phaser-harkat/phaser-udemy/state0.js diff --git a/public/phaser-harkat/phaser-udemy/state1.js b/phaser-harkat/phaser-udemy/state1.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state1.js rename to phaser-harkat/phaser-udemy/state1.js diff --git a/public/phaser-harkat/phaser-udemy/state2.js b/phaser-harkat/phaser-udemy/state2.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state2.js rename to phaser-harkat/phaser-udemy/state2.js diff --git a/public/phaser-harkat/phaser-udemy/state3.js b/phaser-harkat/phaser-udemy/state3.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state3.js rename to phaser-harkat/phaser-udemy/state3.js diff --git a/public/phaser-harkat/phaser-udemy/state4.js b/phaser-harkat/phaser-udemy/state4.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state4.js rename to phaser-harkat/phaser-udemy/state4.js diff --git a/public/phaser-harkat/phaser-udemy/state5.js b/phaser-harkat/phaser-udemy/state5.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state5.js rename to phaser-harkat/phaser-udemy/state5.js diff --git a/public/phaser-harkat/phaser-udemy/state6.js b/phaser-harkat/phaser-udemy/state6.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state6.js rename to phaser-harkat/phaser-udemy/state6.js diff --git a/public/phaser-harkat/phaser-udemy/state7.js b/phaser-harkat/phaser-udemy/state7.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state7.js rename to phaser-harkat/phaser-udemy/state7.js diff --git a/public/phaser-harkat/phaser-udemy/state8.js b/phaser-harkat/phaser-udemy/state8.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state8.js rename to phaser-harkat/phaser-udemy/state8.js diff --git a/public/phaser-harkat/phaser-udemy/state9.js b/phaser-harkat/phaser-udemy/state9.js similarity index 100% rename from public/phaser-harkat/phaser-udemy/state9.js rename to phaser-harkat/phaser-udemy/state9.js diff --git a/public/phaser-harkat/phaser-udemy/style.css b/phaser-harkat/phaser-udemy/style.css similarity index 100% rename from public/phaser-harkat/phaser-udemy/style.css rename to phaser-harkat/phaser-udemy/style.css diff --git a/public/phaser-harkat/phaser/phaser.min.js b/phaser-harkat/phaser/phaser.min.js similarity index 100% rename from public/phaser-harkat/phaser/phaser.min.js rename to phaser-harkat/phaser/phaser.min.js diff --git a/public/phaser-harkat/phaser/phaser2.min.js b/phaser-harkat/phaser/phaser2.min.js similarity index 100% rename from public/phaser-harkat/phaser/phaser2.min.js rename to phaser-harkat/phaser/phaser2.min.js diff --git a/public/index.html b/public/index.html index cc7ac280d9af34f898a0efed10e9aa6e1f809b89..68e1346b5f3ac995620d82b771b5c85df7357a7f 100644 --- a/public/index.html +++ b/public/index.html @@ -9,10 +9,10 @@ <h2>Niko Parviainen - K8573</h2> <h2><a href="https://gitlab.labranet.jamk.fi/nikon-kurssirepot/ttos0700">Gitlab-repoon</a></h2> <ul> - <li><a href="phaser-harkat/phaser-tutoriaali/index.html">Phaser-tutoriaali</a></li> - <li><a href="phaser-harkat/phaser-udemy/index.html">Udemyn kurssin demot</a></li> - <li><a href="Roll-a-ball/index.html">Palleron pyörityspeli</a></li> - <li><a href="Survival-shooter/Builds/index.html">Selviytymisammunta</a></li> + <li><a href="../phaser-harkat/phaser-tutoriaali/index.html">Phaser-tutoriaali</a></li> + <li><a href="../phaser-harkat/phaser-udemy/index.html">Udemyn kurssin demot</a></li> + <li><a href="../phaser-harkat/Roll-a-ball/index.html">Palleron pyörityspeli</a></li> + <li><a href="../Survival-shooter/Builds/index.html">Selviytymisammunta</a></li> <li></li> </ul> </body> diff --git a/public/phaser-harkat/phaser-tutoriaali/assets/bomb.png b/public/phaser-harkat/phaser-tutoriaali/assets/bomb.png deleted file mode 100644 index 28a0fbbddc37fd0a6872bbd170cbebdc81e7f597..0000000000000000000000000000000000000000 Binary files a/public/phaser-harkat/phaser-tutoriaali/assets/bomb.png and /dev/null differ diff --git a/public/phaser-harkat/phaser-tutoriaali/assets/dude.png b/public/phaser-harkat/phaser-tutoriaali/assets/dude.png deleted file mode 100644 index 6b35f4b4b1b00e757700e0852b8527200e82c538..0000000000000000000000000000000000000000 Binary files a/public/phaser-harkat/phaser-tutoriaali/assets/dude.png and /dev/null differ diff --git a/public/phaser-harkat/phaser-tutoriaali/assets/platform.png b/public/phaser-harkat/phaser-tutoriaali/assets/platform.png deleted file mode 100644 index 1e4a3f86d7311592c4fdd257daaf21db4176dd21..0000000000000000000000000000000000000000 Binary files a/public/phaser-harkat/phaser-tutoriaali/assets/platform.png and /dev/null differ diff --git a/public/phaser-harkat/phaser-tutoriaali/assets/sky.png b/public/phaser-harkat/phaser-tutoriaali/assets/sky.png deleted file mode 100644 index 5972639f229c7362edac856b42b86b93811ef3f2..0000000000000000000000000000000000000000 Binary files a/public/phaser-harkat/phaser-tutoriaali/assets/sky.png and /dev/null differ diff --git a/public/phaser-harkat/phaser-tutoriaali/assets/star.png b/public/phaser-harkat/phaser-tutoriaali/assets/star.png deleted file mode 100644 index bfc2d298426648f2a31e48db711b84a9962af703..0000000000000000000000000000000000000000 Binary files a/public/phaser-harkat/phaser-tutoriaali/assets/star.png and /dev/null differ diff --git a/public/phaser-harkat/phaser-tutoriaali/index.html b/public/phaser-harkat/phaser-tutoriaali/index.html deleted file mode 100644 index 1ce3c2c567ccf12d4250989091d99be32754c944..0000000000000000000000000000000000000000 --- a/public/phaser-harkat/phaser-tutoriaali/index.html +++ /dev/null @@ -1,197 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="UTF-8" /> - <title>Making your first Phaser 3 Game - Part 1</title> - <script src="//cdn.jsdelivr.net/npm/phaser@3.11.0/dist/phaser.js"></script> - <style type="text/css"> - body { - margin: 0; - } - </style> -</head> -<body> - -<script type="text/javascript"> - - var config = { - type: Phaser.AUTO, - width: 800, - height: 600, - physics: { - default: 'arcade', - arcade: { - gravity: { y: 300 }, - debug: false - } - }, - scene: { - preload: preload, - create: create, - update: update - } - }; - var score = 0; - var scoreText; - var game = new Phaser.Game(config); - - function preload () - { - //ladataan alussa, ei vielä näytetä mitään - this.load.image('sky', 'assets/sky.png'); - this.load.image('ground', 'assets/platform.png'); - this.load.image('star', 'assets/star.png'); - this.load.image('bomb', 'assets/bomb.png'); - this.load.spritesheet('dude', - 'assets/dude.png', - { frameWidth: 32, frameHeight: 48 } - ); - } - - function create () - { - //lisätään grafiikka peliin - this.add.image(400, 300, 'sky'); - - // - platforms = this.physics.add.staticGroup(); - - platforms.create(400, 568, 'ground').setScale(2).refreshBody(); - - platforms.create(600, 400, 'ground'); - platforms.create(50, 250, 'ground'); - platforms.create(750, 220, 'ground'); - - //luodaan pelaaja - player = this.physics.add.sprite(100, 450, 'dude'); - - //määritellään fysiikat - player.setBounce(0.2); //pelaaja pomppii kun osuu maahan - player.setCollideWorldBounds(true); //estetään pääsy pelimaailman ulkopuolelle - player.body.setGravityY(500); //simuloidaan painovoimaa - - //määritetään animaatiot - //pelihahmo ladattu spritesheettinä, joten määritetään mitä frameja käytetään - this.anims.create({ - key: 'left', - frames: this.anims.generateFrameNumbers('dude', { start: 0, end: 3 }), - frameRate: 10, - repeat: -1 - }); - - this.anims.create({ - key: 'turn', - frames: [ { key: 'dude', frame: 4 } ], - frameRate: 20 - }); - - this.anims.create({ - key: 'right', - frames: this.anims.generateFrameNumbers('dude', { start: 5, end: 8 }), - frameRate: 10, - repeat: -1 - }); - - //collision-testi - this.physics.add.collider(player, platforms); - - //input - cursors = this.input.keyboard.createCursorKeys(); - - stars = this.physics.add.group({ - key: 'star', - repeat: 11, - setXY: { x: 12, y: 0, stepX: 70 } - }); - - stars.children.iterate(function (child) { - - child.setBounceY(Phaser.Math.FloatBetween(0.4, 0.8)); - - }); - - //tähtien collisionit - this.physics.add.collider(stars, platforms); - this.physics.add.overlap(player, stars, collectStar, null, this); - - //score - scoreText = this.add.text(16, 16, 'score: 0', { fontSize: '32px', fill: '#000', fontFamily: 'arial' }); - - //viholliset - bombs = this.physics.add.group(); - - this.physics.add.collider(bombs, platforms); - - this.physics.add.collider(player, bombs, hitBomb, null, this); - - } - - function update () - { - //perusliikkuminen, - if (cursors.left.isDown) - { - player.setVelocityX(-300); - - player.anims.play('left', true); - } - else if (cursors.right.isDown) - { - player.setVelocityX(300); - - player.anims.play('right', true); - } - else - { - player.setVelocityX(0); - - player.anims.play('turn'); - } - - if (cursors.up.isDown && player.body.touching.down) - { - player.setVelocityY(-630); - } - } - - //pelaajan ja tähden collision => poistetaan tähti ja annetaan pisteitä - function collectStar (player, star) - { - star.disableBody(true, true); - - score += 10; - scoreText.setText('Score: ' + score); - - //mikäli tähtiä ei jäljellä, spawnataan pommit ja päästetään helvetti irti - if (stars.countActive(true) === 0) - { - stars.children.iterate(function (child) { - - child.enableBody(true, child.x, 0, true, true); - - }); - - var x = (player.x < 400) ? Phaser.Math.Between(400, 800) : Phaser.Math.Between(0, 400); - - var bomb = bombs.create(x, 16, 'bomb'); - bomb.setBounce(1); - bomb.setCollideWorldBounds(true); - bomb.setVelocity(Phaser.Math.Between(-200, 200), 20); - } - } - - //pelaajan ja pommin collision - function hitBomb (player, bomb) - { - this.physics.pause(); - - player.setTint(0xff0000); - - player.anims.play('turn'); - - gameOver = true; - } -</script> - -</body> -</html> \ No newline at end of file