diff options
author | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-23 18:32:29 +0100 |
---|---|---|
committer | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-23 18:32:29 +0100 |
commit | a840990bdcabf45fb0d377478ba0ab27222434ae (patch) | |
tree | 030a6c3a6befce284733f5643d3972e3a1504bb2 |
initial commit
121 files changed, 574 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..09c2dff --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +BOSHY\ FILES/* @@ -0,0 +1 @@ +BOSHY\ FILES/* diff --git a/assets/ase/boshy.ase b/assets/ase/boshy.ase Binary files differnew file mode 100644 index 0000000..c751512 --- /dev/null +++ b/assets/ase/boshy.ase diff --git a/assets/music/Ace Combat Megalith.ogg b/assets/music/Ace Combat Megalith.ogg Binary files differnew file mode 100644 index 0000000..e7302a5 --- /dev/null +++ b/assets/music/Ace Combat Megalith.ogg diff --git a/assets/music/loludied.ogg b/assets/music/loludied.ogg Binary files differnew file mode 100644 index 0000000..e6b82ec --- /dev/null +++ b/assets/music/loludied.ogg diff --git a/assets/music/terranigma-theunderworld.ogg b/assets/music/terranigma-theunderworld.ogg Binary files differnew file mode 100644 index 0000000..92504ca --- /dev/null +++ b/assets/music/terranigma-theunderworld.ogg diff --git a/assets/sounds/AHHHHHHHHHHHHHHHHHHHHHHHHHHHH.ogg b/assets/sounds/AHHHHHHHHHHHHHHHHHHHHHHHHHHHH.ogg Binary files differnew file mode 100644 index 0000000..a6628f3 --- /dev/null +++ b/assets/sounds/AHHHHHHHHHHHHHHHHHHHHHHHHHHHH.ogg diff --git a/assets/sounds/Awww.ogg b/assets/sounds/Awww.ogg Binary files differnew file mode 100644 index 0000000..72ae355 --- /dev/null +++ b/assets/sounds/Awww.ogg diff --git a/assets/sounds/BLAAHLouder.ogg b/assets/sounds/BLAAHLouder.ogg Binary files differnew file mode 100644 index 0000000..6169d4f --- /dev/null +++ b/assets/sounds/BLAAHLouder.ogg diff --git a/assets/sounds/ItsBOSHYtime.ogg b/assets/sounds/ItsBOSHYtime.ogg Binary files differnew file mode 100644 index 0000000..af80104 --- /dev/null +++ b/assets/sounds/ItsBOSHYtime.ogg diff --git a/assets/sounds/Noho (2).ogg b/assets/sounds/Noho (2).ogg Binary files differnew file mode 100644 index 0000000..e949793 --- /dev/null +++ b/assets/sounds/Noho (2).ogg diff --git a/assets/sounds/SF33RD_0014.wav b/assets/sounds/SF33RD_0014.wav Binary files differnew file mode 100644 index 0000000..f917a0d --- /dev/null +++ b/assets/sounds/SF33RD_0014.wav diff --git a/assets/sounds/SF33RD_0054.wav b/assets/sounds/SF33RD_0054.wav Binary files differnew file mode 100644 index 0000000..ab1926a --- /dev/null +++ b/assets/sounds/SF33RD_0054.wav diff --git a/assets/sounds/Small_Explosion.ogg b/assets/sounds/Small_Explosion.ogg Binary files differnew file mode 100644 index 0000000..ae3d702 --- /dev/null +++ b/assets/sounds/Small_Explosion.ogg diff --git a/assets/sounds/SoFuckingClose.ogg b/assets/sounds/SoFuckingClose.ogg Binary files differnew file mode 100644 index 0000000..e53ee6e --- /dev/null +++ b/assets/sounds/SoFuckingClose.ogg diff --git a/assets/sounds/Solgryn_OMNOMNOM.ogg b/assets/sounds/Solgryn_OMNOMNOM.ogg Binary files differnew file mode 100644 index 0000000..80584e5 --- /dev/null +++ b/assets/sounds/Solgryn_OMNOMNOM.ogg diff --git a/assets/sounds/Solgryn_roar.ogg b/assets/sounds/Solgryn_roar.ogg Binary files differnew file mode 100644 index 0000000..bd0631f --- /dev/null +++ b/assets/sounds/Solgryn_roar.ogg diff --git a/assets/sounds/Solgryn_shoot (2).ogg b/assets/sounds/Solgryn_shoot (2).ogg Binary files differnew file mode 100644 index 0000000..0d530a8 --- /dev/null +++ b/assets/sounds/Solgryn_shoot (2).ogg diff --git a/assets/sounds/alien bomb explosion 2.ogg b/assets/sounds/alien bomb explosion 2.ogg Binary files differnew file mode 100644 index 0000000..4a10eda --- /dev/null +++ b/assets/sounds/alien bomb explosion 2.ogg diff --git a/assets/sounds/alien explosion.ogg b/assets/sounds/alien explosion.ogg Binary files differnew file mode 100644 index 0000000..d4c0006 --- /dev/null +++ b/assets/sounds/alien explosion.ogg diff --git a/assets/sounds/alienbomb explosion.ogg b/assets/sounds/alienbomb explosion.ogg Binary files differnew file mode 100644 index 0000000..02ef2b1 --- /dev/null +++ b/assets/sounds/alienbomb explosion.ogg diff --git a/assets/sounds/hyperbeam.ogg b/assets/sounds/hyperbeam.ogg Binary files differnew file mode 100644 index 0000000..791933b --- /dev/null +++ b/assets/sounds/hyperbeam.ogg diff --git a/assets/sounds/nooooooooooooooooooooooooooooooooo (2).ogg b/assets/sounds/nooooooooooooooooooooooooooooooooo (2).ogg Binary files differnew file mode 100644 index 0000000..e19df63 --- /dev/null +++ b/assets/sounds/nooooooooooooooooooooooooooooooooo (2).ogg diff --git a/assets/sounds/shoot.ogg b/assets/sounds/shoot.ogg Binary files differnew file mode 100644 index 0000000..e52845d --- /dev/null +++ b/assets/sounds/shoot.ogg diff --git a/assets/sounds/slag.ogg b/assets/sounds/slag.ogg Binary files differnew file mode 100644 index 0000000..f1ce2db --- /dev/null +++ b/assets/sounds/slag.ogg diff --git a/assets/sounds/solgryn_laser.ogg b/assets/sounds/solgryn_laser.ogg Binary files differnew file mode 100644 index 0000000..1bc6825 --- /dev/null +++ b/assets/sounds/solgryn_laser.ogg diff --git a/assets/sounds/solgryn_shielf_hurt.ogg b/assets/sounds/solgryn_shielf_hurt.ogg Binary files differnew file mode 100644 index 0000000..baf0f4c --- /dev/null +++ b/assets/sounds/solgryn_shielf_hurt.ogg diff --git a/assets/sounds/splash.ogg b/assets/sounds/splash.ogg Binary files differnew file mode 100644 index 0000000..d27a941 --- /dev/null +++ b/assets/sounds/splash.ogg diff --git a/assets/sounds/teleport (2).ogg b/assets/sounds/teleport (2).ogg Binary files differnew file mode 100644 index 0000000..1655d65 --- /dev/null +++ b/assets/sounds/teleport (2).ogg diff --git a/assets/sounds/teleport (3).ogg b/assets/sounds/teleport (3).ogg Binary files differnew file mode 100644 index 0000000..c1b69b1 --- /dev/null +++ b/assets/sounds/teleport (3).ogg diff --git a/assets/sprites/bigexplosion1.png b/assets/sprites/bigexplosion1.png Binary files differnew file mode 100644 index 0000000..947d00a --- /dev/null +++ b/assets/sprites/bigexplosion1.png diff --git a/assets/sprites/bigexplosion10.png b/assets/sprites/bigexplosion10.png Binary files differnew file mode 100644 index 0000000..ff2322d --- /dev/null +++ b/assets/sprites/bigexplosion10.png diff --git a/assets/sprites/bigexplosion11.png b/assets/sprites/bigexplosion11.png Binary files differnew file mode 100644 index 0000000..dc7abe4 --- /dev/null +++ b/assets/sprites/bigexplosion11.png diff --git a/assets/sprites/bigexplosion12.png b/assets/sprites/bigexplosion12.png Binary files differnew file mode 100644 index 0000000..1b0bf12 --- /dev/null +++ b/assets/sprites/bigexplosion12.png diff --git a/assets/sprites/bigexplosion13.png b/assets/sprites/bigexplosion13.png Binary files differnew file mode 100644 index 0000000..3925601 --- /dev/null +++ b/assets/sprites/bigexplosion13.png diff --git a/assets/sprites/bigexplosion14.png b/assets/sprites/bigexplosion14.png Binary files differnew file mode 100644 index 0000000..96ded1c --- /dev/null +++ b/assets/sprites/bigexplosion14.png diff --git a/assets/sprites/bigexplosion15.png b/assets/sprites/bigexplosion15.png Binary files differnew file mode 100644 index 0000000..f1780c3 --- /dev/null +++ b/assets/sprites/bigexplosion15.png diff --git a/assets/sprites/bigexplosion16.png b/assets/sprites/bigexplosion16.png Binary files differnew file mode 100644 index 0000000..7160306 --- /dev/null +++ b/assets/sprites/bigexplosion16.png diff --git a/assets/sprites/bigexplosion17.png b/assets/sprites/bigexplosion17.png Binary files differnew file mode 100644 index 0000000..6442f68 --- /dev/null +++ b/assets/sprites/bigexplosion17.png diff --git a/assets/sprites/bigexplosion18.png b/assets/sprites/bigexplosion18.png Binary files differnew file mode 100644 index 0000000..337e3e3 --- /dev/null +++ b/assets/sprites/bigexplosion18.png diff --git a/assets/sprites/bigexplosion19.png b/assets/sprites/bigexplosion19.png Binary files differnew file mode 100644 index 0000000..c852418 --- /dev/null +++ b/assets/sprites/bigexplosion19.png diff --git a/assets/sprites/bigexplosion2.png b/assets/sprites/bigexplosion2.png Binary files differnew file mode 100644 index 0000000..182bc65 --- /dev/null +++ b/assets/sprites/bigexplosion2.png diff --git a/assets/sprites/bigexplosion3.png b/assets/sprites/bigexplosion3.png Binary files differnew file mode 100644 index 0000000..97d1cb0 --- /dev/null +++ b/assets/sprites/bigexplosion3.png diff --git a/assets/sprites/bigexplosion4.png b/assets/sprites/bigexplosion4.png Binary files differnew file mode 100644 index 0000000..0018213 --- /dev/null +++ b/assets/sprites/bigexplosion4.png diff --git a/assets/sprites/bigexplosion5.png b/assets/sprites/bigexplosion5.png Binary files differnew file mode 100644 index 0000000..ead38f3 --- /dev/null +++ b/assets/sprites/bigexplosion5.png diff --git a/assets/sprites/bigexplosion6.png b/assets/sprites/bigexplosion6.png Binary files differnew file mode 100644 index 0000000..41bf524 --- /dev/null +++ b/assets/sprites/bigexplosion6.png diff --git a/assets/sprites/bigexplosion7.png b/assets/sprites/bigexplosion7.png Binary files differnew file mode 100644 index 0000000..1302e55 --- /dev/null +++ b/assets/sprites/bigexplosion7.png diff --git a/assets/sprites/bigexplosion8.png b/assets/sprites/bigexplosion8.png Binary files differnew file mode 100644 index 0000000..f0f07c7 --- /dev/null +++ b/assets/sprites/bigexplosion8.png diff --git a/assets/sprites/bigexplosion9.png b/assets/sprites/bigexplosion9.png Binary files differnew file mode 100644 index 0000000..9c6cb34 --- /dev/null +++ b/assets/sprites/bigexplosion9.png diff --git a/assets/sprites/black_background.png b/assets/sprites/black_background.png Binary files differnew file mode 100644 index 0000000..7926ec7 --- /dev/null +++ b/assets/sprites/black_background.png diff --git a/assets/sprites/black_sun_background.png b/assets/sprites/black_sun_background.png Binary files differnew file mode 100644 index 0000000..62fb81c --- /dev/null +++ b/assets/sprites/black_sun_background.png diff --git a/assets/sprites/boshy1.png b/assets/sprites/boshy1.png Binary files differnew file mode 100644 index 0000000..dd1a996 --- /dev/null +++ b/assets/sprites/boshy1.png diff --git a/assets/sprites/boshy2.png b/assets/sprites/boshy2.png Binary files differnew file mode 100644 index 0000000..cdc24c0 --- /dev/null +++ b/assets/sprites/boshy2.png diff --git a/assets/sprites/boshy_bullet.png b/assets/sprites/boshy_bullet.png Binary files differnew file mode 100644 index 0000000..95b89b3 --- /dev/null +++ b/assets/sprites/boshy_bullet.png diff --git a/assets/sprites/explosion1.png b/assets/sprites/explosion1.png Binary files differnew file mode 100644 index 0000000..4164985 --- /dev/null +++ b/assets/sprites/explosion1.png diff --git a/assets/sprites/explosion2.png b/assets/sprites/explosion2.png Binary files differnew file mode 100644 index 0000000..7d1e6b1 --- /dev/null +++ b/assets/sprites/explosion2.png diff --git a/assets/sprites/explosion3.png b/assets/sprites/explosion3.png Binary files differnew file mode 100644 index 0000000..9552877 --- /dev/null +++ b/assets/sprites/explosion3.png diff --git a/assets/sprites/nomnomnom1.png b/assets/sprites/nomnomnom1.png Binary files differnew file mode 100644 index 0000000..50781a1 --- /dev/null +++ b/assets/sprites/nomnomnom1.png diff --git a/assets/sprites/nomnomnom2.png b/assets/sprites/nomnomnom2.png Binary files differnew file mode 100644 index 0000000..2d5f5b7 --- /dev/null +++ b/assets/sprites/nomnomnom2.png diff --git a/assets/sprites/nomnomnom3.png b/assets/sprites/nomnomnom3.png Binary files differnew file mode 100644 index 0000000..a526060 --- /dev/null +++ b/assets/sprites/nomnomnom3.png diff --git a/assets/sprites/oatmeal1.png b/assets/sprites/oatmeal1.png Binary files differnew file mode 100644 index 0000000..0a088a2 --- /dev/null +++ b/assets/sprites/oatmeal1.png diff --git a/assets/sprites/oatmeal2.png b/assets/sprites/oatmeal2.png Binary files differnew file mode 100644 index 0000000..9c1f340 --- /dev/null +++ b/assets/sprites/oatmeal2.png diff --git a/assets/sprites/oatmeal3.png b/assets/sprites/oatmeal3.png Binary files differnew file mode 100644 index 0000000..c633671 --- /dev/null +++ b/assets/sprites/oatmeal3.png diff --git a/assets/sprites/openanimation1.png b/assets/sprites/openanimation1.png Binary files differnew file mode 100644 index 0000000..d9a9d07 --- /dev/null +++ b/assets/sprites/openanimation1.png diff --git a/assets/sprites/openanimation10.png b/assets/sprites/openanimation10.png Binary files differnew file mode 100644 index 0000000..4623096 --- /dev/null +++ b/assets/sprites/openanimation10.png diff --git a/assets/sprites/openanimation11.png b/assets/sprites/openanimation11.png Binary files differnew file mode 100644 index 0000000..f83602c --- /dev/null +++ b/assets/sprites/openanimation11.png diff --git a/assets/sprites/openanimation12.png b/assets/sprites/openanimation12.png Binary files differnew file mode 100644 index 0000000..f474274 --- /dev/null +++ b/assets/sprites/openanimation12.png diff --git a/assets/sprites/openanimation2.png b/assets/sprites/openanimation2.png Binary files differnew file mode 100644 index 0000000..ec233db --- /dev/null +++ b/assets/sprites/openanimation2.png diff --git a/assets/sprites/openanimation3.png b/assets/sprites/openanimation3.png Binary files differnew file mode 100644 index 0000000..75afbdc --- /dev/null +++ b/assets/sprites/openanimation3.png diff --git a/assets/sprites/openanimation4.png b/assets/sprites/openanimation4.png Binary files differnew file mode 100644 index 0000000..a811db2 --- /dev/null +++ b/assets/sprites/openanimation4.png diff --git a/assets/sprites/openanimation5.png b/assets/sprites/openanimation5.png Binary files differnew file mode 100644 index 0000000..c901040 --- /dev/null +++ b/assets/sprites/openanimation5.png diff --git a/assets/sprites/openanimation6.png b/assets/sprites/openanimation6.png Binary files differnew file mode 100644 index 0000000..442a798 --- /dev/null +++ b/assets/sprites/openanimation6.png diff --git a/assets/sprites/openanimation7.png b/assets/sprites/openanimation7.png Binary files differnew file mode 100644 index 0000000..dccaba0 --- /dev/null +++ b/assets/sprites/openanimation7.png diff --git a/assets/sprites/openanimation8.png b/assets/sprites/openanimation8.png Binary files differnew file mode 100644 index 0000000..b7bf1bc --- /dev/null +++ b/assets/sprites/openanimation8.png diff --git a/assets/sprites/openanimation9.png b/assets/sprites/openanimation9.png Binary files differnew file mode 100644 index 0000000..a415644 --- /dev/null +++ b/assets/sprites/openanimation9.png diff --git a/assets/sprites/portal1.png b/assets/sprites/portal1.png Binary files differnew file mode 100644 index 0000000..9456860 --- /dev/null +++ b/assets/sprites/portal1.png diff --git a/assets/sprites/portal10.png b/assets/sprites/portal10.png Binary files differnew file mode 100644 index 0000000..993d73f --- /dev/null +++ b/assets/sprites/portal10.png diff --git a/assets/sprites/portal11.png b/assets/sprites/portal11.png Binary files differnew file mode 100644 index 0000000..d6eab7e --- /dev/null +++ b/assets/sprites/portal11.png diff --git a/assets/sprites/portal12.png b/assets/sprites/portal12.png Binary files differnew file mode 100644 index 0000000..f72177d --- /dev/null +++ b/assets/sprites/portal12.png diff --git a/assets/sprites/portal13.png b/assets/sprites/portal13.png Binary files differnew file mode 100644 index 0000000..019ac21 --- /dev/null +++ b/assets/sprites/portal13.png diff --git a/assets/sprites/portal14.png b/assets/sprites/portal14.png Binary files differnew file mode 100644 index 0000000..349725e --- /dev/null +++ b/assets/sprites/portal14.png diff --git a/assets/sprites/portal15.png b/assets/sprites/portal15.png Binary files differnew file mode 100644 index 0000000..bedc9c3 --- /dev/null +++ b/assets/sprites/portal15.png diff --git a/assets/sprites/portal2.png b/assets/sprites/portal2.png Binary files differnew file mode 100644 index 0000000..2767264 --- /dev/null +++ b/assets/sprites/portal2.png diff --git a/assets/sprites/portal3.png b/assets/sprites/portal3.png Binary files differnew file mode 100644 index 0000000..3004d0a --- /dev/null +++ b/assets/sprites/portal3.png diff --git a/assets/sprites/portal4.png b/assets/sprites/portal4.png Binary files differnew file mode 100644 index 0000000..49a03d1 --- /dev/null +++ b/assets/sprites/portal4.png diff --git a/assets/sprites/portal5.png b/assets/sprites/portal5.png Binary files differnew file mode 100644 index 0000000..5d8b082 --- /dev/null +++ b/assets/sprites/portal5.png diff --git a/assets/sprites/portal6.png b/assets/sprites/portal6.png Binary files differnew file mode 100644 index 0000000..2fda26f --- /dev/null +++ b/assets/sprites/portal6.png diff --git a/assets/sprites/portal7.png b/assets/sprites/portal7.png Binary files differnew file mode 100644 index 0000000..33ead33 --- /dev/null +++ b/assets/sprites/portal7.png diff --git a/assets/sprites/portal8.png b/assets/sprites/portal8.png Binary files differnew file mode 100644 index 0000000..c13e185 --- /dev/null +++ b/assets/sprites/portal8.png diff --git a/assets/sprites/portal9.png b/assets/sprites/portal9.png Binary files differnew file mode 100644 index 0000000..ca463cf --- /dev/null +++ b/assets/sprites/portal9.png diff --git a/assets/sprites/shitbullet.png b/assets/sprites/shitbullet.png Binary files differnew file mode 100644 index 0000000..d53a4cf --- /dev/null +++ b/assets/sprites/shitbullet.png diff --git a/assets/sprites/skylaser1.png b/assets/sprites/skylaser1.png Binary files differnew file mode 100644 index 0000000..762cd21 --- /dev/null +++ b/assets/sprites/skylaser1.png diff --git a/assets/sprites/skylaser2.png b/assets/sprites/skylaser2.png Binary files differnew file mode 100644 index 0000000..65421e8 --- /dev/null +++ b/assets/sprites/skylaser2.png diff --git a/assets/sprites/skylaser3.png b/assets/sprites/skylaser3.png Binary files differnew file mode 100644 index 0000000..eb55807 --- /dev/null +++ b/assets/sprites/skylaser3.png diff --git a/assets/sprites/skylaser4.png b/assets/sprites/skylaser4.png Binary files differnew file mode 100644 index 0000000..f02bdb6 --- /dev/null +++ b/assets/sprites/skylaser4.png diff --git a/assets/sprites/skylaser5.png b/assets/sprites/skylaser5.png Binary files differnew file mode 100644 index 0000000..aec41ff --- /dev/null +++ b/assets/sprites/skylaser5.png diff --git a/assets/sprites/skylaser6.png b/assets/sprites/skylaser6.png Binary files differnew file mode 100644 index 0000000..3b87e39 --- /dev/null +++ b/assets/sprites/skylaser6.png diff --git a/assets/sprites/solgryn.png b/assets/sprites/solgryn.png Binary files differnew file mode 100644 index 0000000..0071230 --- /dev/null +++ b/assets/sprites/solgryn.png diff --git a/assets/sprites/solgryn_fight.png b/assets/sprites/solgryn_fight.png Binary files differnew file mode 100644 index 0000000..b169e07 --- /dev/null +++ b/assets/sprites/solgryn_fight.png diff --git a/assets/sprites/solgryn_open1.png b/assets/sprites/solgryn_open1.png Binary files differnew file mode 100644 index 0000000..f01d25a --- /dev/null +++ b/assets/sprites/solgryn_open1.png diff --git a/assets/sprites/solgryn_open2.png b/assets/sprites/solgryn_open2.png Binary files differnew file mode 100644 index 0000000..c77a14f --- /dev/null +++ b/assets/sprites/solgryn_open2.png diff --git a/assets/sprites/solgryn_open3.png b/assets/sprites/solgryn_open3.png Binary files differnew file mode 100644 index 0000000..ec27484 --- /dev/null +++ b/assets/sprites/solgryn_open3.png diff --git a/assets/sprites/solgryn_sun.png b/assets/sprites/solgryn_sun.png Binary files differnew file mode 100644 index 0000000..6fa73ac --- /dev/null +++ b/assets/sprites/solgryn_sun.png diff --git a/countlines.sh b/countlines.sh new file mode 100755 index 0000000..62858f9 --- /dev/null +++ b/countlines.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash +echo " +js lines of code: " +find . -name '*.js' | xargs wc -l + +echo " +scss lines of code: " +find . -name '*.scss' | xargs wc -l + +echo "" diff --git a/index.html b/index.html new file mode 100644 index 0000000..0597f29 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="UTF-8"> +<title></title> +<link rel="stylesheet" href="style.css"> +<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon"> +</head> + +<body> +</body> + +<script type="module" src="index.js"></script> +</html> diff --git a/index.js b/index.js new file mode 100644 index 0000000..e43c3f2 --- /dev/null +++ b/index.js @@ -0,0 +1,32 @@ +import { Engine } from "./src/engine.js" +Engine.startEngine() + +// import { start, update, draw } from "./src/main.js"; +// const fps = 60 +// +// +// /* cap the game's fps */ +// let msPrev = window.performance.now() +// const msPerFrame = 1000 / fps +// let frames = 0 +// function gameloop() { +// window.requestAnimationFrame(gameloop) +// +// const msNow = window.performance.now() +// const msPassed = msNow - msPrev +// +// if (msPassed < msPerFrame) return +// +// const excessTime = msPassed % msPerFrame +// msPrev = msNow - excessTime +// +// frames++ +// +// update() +// draw() +// } +// +// /* call functions to start the game */ +// /* the game logic can be found in src */ +// start() +// gameloop() diff --git a/scss/index.scss b/scss/index.scss new file mode 100644 index 0000000..177f5fd --- /dev/null +++ b/scss/index.scss @@ -0,0 +1,35 @@ +body { + margin: 0; + background-color: grey; + width: 100%; + height: 100%; +} + +img { + position: absolute; + top: 0; + left: 0; +} + +.background { + width: 100%; + height: 100%; +} + +#spawn { + position: relative; + top: 0; + left: 0; + width: 0; + height: 0; +} + +#screen { + display: block; + overflow: hidden; + background-size: cover; + position: absolute; + top: 0; + left: 0; +} + diff --git a/src/assets.js b/src/assets.js new file mode 100644 index 0000000..4a51716 --- /dev/null +++ b/src/assets.js @@ -0,0 +1,22 @@ +export const BOSHY = { + NORMAL: "./assets/sprites/boshy1.png", + DAMAGED:"./assets/sprites/boshy2.png", + BULLET: "./assets/sprites/boshy_bullet.png", + + SOUNDS: { + SHOOT: "./assets/sounds/shoot.ogg", + INTRO: "./assets/sounds/ItsBOSHYtime.ogg", + } +} + +export const BACKGROUND = { + DEFAULT: "./assets/sprites/black_background.png", + DARK_SUN: "./assets/sprites/black_sun_background.png", +} + +export const MUSIC = { + SOLGRYN: './assets/music/Ace Combat Megalith.ogg', + DEATH: './assets/music/loludied.ogg', + PREQUEL: './assets/music/terranigma-theunderworld.ogg', + +} diff --git a/src/engine.js b/src/engine.js new file mode 100644 index 0000000..a7bb8a5 --- /dev/null +++ b/src/engine.js @@ -0,0 +1,34 @@ +import { start, update, draw } from "./main.js" +import { Screen } from "./engine/screen.js" +import { keys, setUpKeyboard } from "./engine/keyboard.js" +import { startClock } from "./engine/clock.js" + +export class Engine { + static frame = 0 + static audio + static screen = new Screen() + static keys = keys + static bgm + + static startEngine() { + setUpKeyboard() + start() + + startClock() + } + + static updateEngine() { + update() + draw() + } + + static playSound(file) { + let audio = new Audio(file) + audio.play() + } + + static playMusic(file) { + this.bgm = new Audio(file) + this.bgm.play() + } +} diff --git a/src/engine/clock.js b/src/engine/clock.js new file mode 100644 index 0000000..e817863 --- /dev/null +++ b/src/engine/clock.js @@ -0,0 +1,26 @@ +import { Engine } from "../engine.js" + +export { Engine } from "../engine.js" +const fps = 60 + +/* cap the game's fps */ +let msPrev = window.performance.now() +const msPerFrame = 1000 / fps +function tick() { + window.requestAnimationFrame(tick) + + const msNow = window.performance.now() + const msPassed = msNow - msPrev + + if (msPassed < msPerFrame) return + + const excessTime = msPassed % msPerFrame + msPrev = msNow - excessTime + + Engine.frame++ + Engine.updateEngine() +} + +export function startClock() { + tick() +} diff --git a/src/engine/keyboard.js b/src/engine/keyboard.js new file mode 100644 index 0000000..d634519 --- /dev/null +++ b/src/engine/keyboard.js @@ -0,0 +1,23 @@ +export function setUpKeyboard() { + document.addEventListener("keyup", k => trigger(k)) + document.addEventListener("keydown", k => trigger(k)) +} + +export const keys = { + right: false, + left: false, + up: false, + down: false, + shoot: false, +} + +function trigger(event) { + let on = event.type == "keydown" + switch (event.key) { + case "ArrowRight": keys.right = on; break; + case "ArrowLeft": keys.left = on; break; + case "ArrowUp": keys.up = on; break; + case "ArrowDown": keys.down = on; break; + case "z": case "Z": keys.shoot = on; break; + } +} diff --git a/src/engine/screen.js b/src/engine/screen.js new file mode 100644 index 0000000..2d32b62 --- /dev/null +++ b/src/engine/screen.js @@ -0,0 +1,87 @@ +import { Vector } from "./vector.js" +import { BACKGROUND } from "../assets.js" + +export class Screen { + viewport = new Vector(650, 500) + + ///////////////////// START ////////////////////// + constructor() { + this.createHTMLElements() + this.setUpTriggers() + this.resize() + } + + createHTMLElements() { + this.div + this.background + this.spawn + + /* create main div */ + this.div = document.createElement("div") + this.div.id = "screen" + this.div.style.backgroundColor = "black" + + /* create background image */ + this.background = document.createElement("img") + this.background.className = "background" + this.background.src = `${BACKGROUND.DEFAULT}` + this.background.style.visibility = "hidden" + this.div.appendChild(this.background) + + /* create relative div to append children */ + this.spawn = document.createElement("div") + this.div.appendChild(this.spawn) + document.body.appendChild(this.div) + } + + setUpTriggers() { + addEventListener("resize", () => { this.resize() }); + } + + + ///////////////////// RESIZE ////////////////////// + real_position = new Vector(0, 0) + real_size = new Vector(0, 0) + scale = new Vector(0, 0) + + resize() { + let w = new Vector(window.innerWidth, window.innerHeight) + + /* get max size keeping aspect ratio */ + if (w.y / this.viewport.y > w.x / this.viewport.x) { + this.real_size.x = w.x + this.real_size.y = Math.floor(w.x / this.viewport.x * this.viewport.y) + } else { + this.real_size.y = w.y + this.real_size.x = Math.floor(w.y / this.viewport.y * this.viewport.x) + } + this.div.style.width = `${this.real_size.x}px` + this.div.style.height = `${this.real_size.y}px` + + /* get centered position */ + this.real_position.x = w.x / 2 - this.real_size.x / 2 + this.real_position.y = w.y / 2 - this.real_size.y / 2 + this.real_position.floor() + + this.div.style.left = `${this.real_position.x}px` + this.div.style.top = `${this.real_position.y}px` + + /* set scale */ + this.scale = this.real_size.x / this.viewport.x + } + + + ///////////////////// COMMANDS ////////////////////// + append(element) { this.spawn.appendChild(element) } + + draw(span, position, size, /* rotation = 0 */) { + span.style.width = `${size.x * this.scale}px` + span.style.height = `${size.y * this.scale}px` + span.style.top = `${(position.y - size.x / 2) * this.scale}px` + span.style.left = `${(position.x - size.y / 2) * this.scale}px` + } + + setBackground(img) { this.background.src = img } + showBackground() { this.background.visibility = "visible" } + hideBackground() { this.background.visibility = "hidden" } +} diff --git a/src/engine/vector.js b/src/engine/vector.js new file mode 100644 index 0000000..452e47b --- /dev/null +++ b/src/engine/vector.js @@ -0,0 +1,47 @@ +export class Vector { + constructor(x=0, y=0) { + this.x = x + this.y = y + } + + add(newVector) { + this.x += newVector.x + this.y += newVector.y + return this + } + + normalize() { + if (this.x != 0 && 0 != this.y) { + let hyp = Math.abs(this.x) + let cSquared = Math.pow(hyp, 2) / 2 + let c = Math.sqrt(cSquared, 2) + + this.x = this.x / Math.abs(this.x) * c + this.y = this.y / Math.abs(this.x) * c + } + return this + } + + multiply(multiplier) { + this.x *= multiplier + this.y *= multiplier + return this + } + + clone() { + return new Vector(this.x, this.y) + } + + static division(vector_a, vector_b) { + return new Vector( + vector_a.x / vector_b.x, + vector_a.y / vector_b.y + ) + } + + floor() { + this.x = Math.floor(this.x) + this.y = Math.floor(this.y) + return this + } +} diff --git a/src/entities/boshy.js b/src/entities/boshy.js new file mode 100644 index 0000000..ea6068d --- /dev/null +++ b/src/entities/boshy.js @@ -0,0 +1,65 @@ +import { BOSHY } from "../assets.js" +import { Vector } from "../engine/vector.js" +import { Engine } from "../engine.js" +import { BoshyBullet } from "./boshybullet.js" +import { Entity } from "./entity.js" + +export class Boshy extends Entity { + reloadTime = 6 + lastShot = 0 + speed = 5 + + constructor() { + super({ + size: new Vector(30, 30), + position: new Vector(325, 400), + sprite: BOSHY.NORMAL, + }) + + Engine.playSound(BOSHY.SOUNDS.INTRO) + } + + update() { + let keys = Engine.keys + let viewport = Engine.screen.viewport + + /* get movement direction */ + let move = new Vector() + let speed = this.speed + if (keys.right) move.x += 1 + if (keys.left) move.x -= 1 + if (keys.up) move.y -= 1 + if (keys.down) move.y += 1 + if (keys.shoot) this.shoot() + + /* apply movement */ + move.normalize() + move.multiply(speed) + this.position.add(move) + + /* check limits */ + if (this.position.x < 0) this.position.x = 0 + if (this.position.y < 0) this.position.y = 0 + if (this.position.x > viewport.x) this.position.x = viewport.x + if (this.position.y > viewport.y) this.position.y = viewport.y + } + + shoot() { + /* check if it can shoot */ + if (Engine.frame < this.lastShot + this.reloadTime) { + return + } + + this.lastShot = Engine.frame /*(reset reload)*/ + + let bullet_a_position = this.position.clone() + let bullet_b_position = this.position.clone() + + bullet_a_position.x = bullet_a_position.x + 5 + bullet_b_position.x = bullet_b_position.x - 5 + + new BoshyBullet(bullet_a_position) + new BoshyBullet(bullet_b_position) + Engine.playSound(BOSHY.SOUNDS.SHOOT) + } +} diff --git a/src/entities/boshybullet.js b/src/entities/boshybullet.js new file mode 100644 index 0000000..ed91ede --- /dev/null +++ b/src/entities/boshybullet.js @@ -0,0 +1,30 @@ +import { BOSHY } from "../assets.js" +import { Vector } from "../engine/vector.js" +import { bullets } from "../main.js" +import { Entity } from "./entity.js" + +export class BoshyBullet extends Entity { + speed = 20 + + constructor(position = new Vector(0,0)) { + super({ + size: new Vector(5, 5), + position: position.floor(), + sprite: BOSHY.BULLET, + }) + + bullets.list.push(this) + } + + update() { + this.position.y -= this.speed + if (this.position.y < 0) { + this.span.remove() + bullets.remove(this) + } + } + + remove() { + this.span.remove() + } +} diff --git a/src/entities/entity.js b/src/entities/entity.js new file mode 100644 index 0000000..ac14d4b --- /dev/null +++ b/src/entities/entity.js @@ -0,0 +1,23 @@ +import { Vector } from "../engine/vector.js" +import { Engine } from "../engine.js" + +export class Entity { + constructor({ + size, + hitbox = size, + sprite, + position = new Vector(0,0), + }) { + this.size = size + this.hitbox = hitbox + this.position = position + + this.span = document.createElement("img") + this.span.src = sprite + Engine.screen.append(this.span) + } + + draw() { + Engine.screen.draw(this.span, this.position, this.size) + } +} diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..6822351 --- /dev/null +++ b/src/main.js @@ -0,0 +1,38 @@ +///////////////////// IMPORTS ////////////////////// +import { Boshy } from "./entities/boshy.js" +import { SCENE, SCENES } from "./scenes.js" + + +///////////////////// GLOBALS ////////////////////// +export let boshy +export const bullets = { + list: [], + remove: instance => { bullets.list = bullets.list.filter(b => b != instance) }, + clear: _ => { bullets.list.forEach(b => b.remove()) } +} + +///////////////////// GAME LOGIC ////////////////////// +export function start() { + console.log("game start") + changeScene(SCENES.PREQUEL) +} + +export function update() { + boshy.update() + bullets.list.forEach((bullet) => bullet.update()) + SCENE.update() +} + +export function draw() { + boshy.draw() + bullets.list.forEach((bullet) => bullet.draw()) + SCENE.draw() +} + + +///////////////////// SCENE METHODS ////////////////////// +export function changeScene(scene) { + SCENE.load(scene) + bullets.clear() + boshy = new Boshy() +} diff --git a/src/scenes.js b/src/scenes.js new file mode 100644 index 0000000..09ea493 --- /dev/null +++ b/src/scenes.js @@ -0,0 +1,30 @@ +import * as PREQUEL from "./scenes/prequel.js" +import * as GAME from "./scenes/game.js" + +export const SCENES = { + PREQUEL: "prequel", + GAME: "game", +} + +export const SCENE = { + load: loadScene, + update: null, + draw: null, +} + +let currentScene + +function loadScene(scene) { + currentScene = scene + if (currentScene == SCENES.PREQUEL) { + PREQUEL.start() + SCENE.update = PREQUEL.update + SCENE.draw = PREQUEL.draw + } + + if (currentScene == SCENES.GAME) { + GAME.start() + SCENE.update = GAME.update + SCENE.draw = GAME.draw + } +} diff --git a/src/scenes/game.js b/src/scenes/game.js new file mode 100644 index 0000000..1640aa5 --- /dev/null +++ b/src/scenes/game.js @@ -0,0 +1,13 @@ +import { Engine } from "../engine.js" +import { MUSIC } from "../assets.js" + +export function start() { + Engine.playMusic(MUSIC.SOLGRYN) +} + + +export function update() { +} + +export function draw() { +} diff --git a/src/scenes/prequel.js b/src/scenes/prequel.js new file mode 100644 index 0000000..f24ef99 --- /dev/null +++ b/src/scenes/prequel.js @@ -0,0 +1,13 @@ +import { Engine } from "../engine.js" +import { MUSIC } from "../assets.js" + +export function start() { + Engine.playMusic(MUSIC.PREQUEL) +} + + +export function update() { +} + +export function draw() { +} diff --git a/style.css b/style.css new file mode 100644 index 0000000..9a64319 --- /dev/null +++ b/style.css @@ -0,0 +1,30 @@ +body { + margin: 0; + background-color: grey; + width: 100%; + height: 100%; } + +img { + position: absolute; + top: 0; + left: 0; } + +.background { + position: inline; + width: 100%; + height: 100%; } + +#spawn { + position: relative; + top: 0; + left: 0; + width: 0; + height: 0; } + +#screen { + display: block; + overflow: hidden; + background-size: cover; + position: absolute; + top: 0; + left: 0; } |