Browse Source

Shooting platform image

Pabloader 2 years ago
parent
commit
15cfc67ea3
11 changed files with 28 additions and 9 deletions
  1. 3
    0
      README.md
  2. 2
    1
      css/style.css
  3. 7
    0
      img/shooting-pad.svg
  4. 7
    7
      index.html
  5. 0
    0
      js/bullet.js
  6. 0
    0
      js/cloud.js
  7. 0
    0
      js/entity.js
  8. 8
    0
      js/game.js
  9. 0
    0
      js/shooting_pad.js
  10. 0
    0
      js/utils.js
  11. 1
    1
      todo.md

+ 3
- 0
README.md View File

@@ -0,0 +1,3 @@
1
+# About
2
+
3
+This game is written for [OLC Code Jam 2022](https://itch.io/jam/olc-codejam-2022)

style.css → css/style.css View File

@@ -38,7 +38,8 @@ html, body {
38 38
 }
39 39
 
40 40
 .shooting-pad {
41
-    background: red;
41
+    background: url('../img/shooting-pad.svg') no-repeat;
42
+    background-size: 100%;
42 43
     animation-iteration-count: 10;
43 44
     animation-duration: 200ms;
44 45
 }

+ 7
- 0
img/shooting-pad.svg View File

@@ -0,0 +1,7 @@
1
+<svg width="48" height="20" xmlns="http://www.w3.org/2000/svg">
2
+    <path
3
+        d="m1,20 l12,-20 l22,0 l12,20z" 
4
+        stroke="#f00" 
5
+        fill="#f00"
6
+    />
7
+</svg>

+ 7
- 7
index.html View File

@@ -2,18 +2,18 @@
2 2
 <html>
3 3
     <head>
4 4
         <title>OLC Codejam 2022</title>
5
-        <link rel="stylesheet" href="style.css">
5
+        <link rel="stylesheet" href="css/style.css">
6 6
         <meta charset="utf-8">
7 7
     </head>
8 8
     <body>
9 9
         <div id="root">
10 10
             <section id="lives"></section>
11 11
         </div>
12
-        <script src="utils.js"></script>
13
-        <script src="entity.js"></script>
14
-        <script src="bullet.js"></script>
15
-        <script src="shooting_pad.js"></script>
16
-        <script src="cloud.js"></script>
17
-        <script src="game.js"></script>
12
+        <script src="js/utils.js"></script>
13
+        <script src="js/entity.js"></script>
14
+        <script src="js/bullet.js"></script>
15
+        <script src="js/shooting_pad.js"></script>
16
+        <script src="js/cloud.js"></script>
17
+        <script src="js/game.js"></script>
18 18
     </body>
19 19
 </html>

bullet.js → js/bullet.js View File


cloud.js → js/cloud.js View File


entity.js → js/entity.js View File


game.js → js/game.js View File

@@ -48,12 +48,16 @@ const loop = () => {
48 48
     if (!running) return;
49 49
 
50 50
     let directionUpdated = false;
51
+    let isOver = false;
51 52
     Array.from(clouds).forEach(c => {
52 53
         c.update(direction);
53 54
         c.draw();
54 55
         if (c.x < X_BOUND - 0.01 || c.x > 1.01 - X_BOUND) {
55 56
             directionUpdated = true;
56 57
         }
58
+        if (c.y >= 0.95) {
59
+            isOver = true;
60
+        }
57 61
         if (!c.alive) {
58 62
             clouds.delete(c);
59 63
         }
@@ -63,6 +67,10 @@ const loop = () => {
63 67
         direction = -direction;
64 68
     }
65 69
 
70
+    if (isOver) {
71
+        gameOver('Game over');
72
+    }
73
+
66 74
     Array.from(bullets).forEach(b => {
67 75
         b.update();
68 76
         b.draw();

shooting_pad.js → js/shooting_pad.js View File


utils.js → js/utils.js View File


+ 1
- 1
todo.md View File

@@ -1,9 +1,9 @@
1 1
 # TODO
2 2
 
3 3
 - [x] lives
4
+- [x] shooting platform sprite
4 5
 - [ ] clouds should strike lightnings sometimes
5 6
 - [ ] bg rain effect
6
-- [ ] shooting platform sprite
7 7
 - [ ] boss?
8 8
 - [ ] umbrella shields
9 9
 - [ ] music & sounds

Loading…
Cancel
Save