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

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
 }
38
 }
39
 
39
 
40
 .shooting-pad {
40
 .shooting-pad {
41
-    background: red;
41
+    background: url('../img/shooting-pad.svg') no-repeat;
42
+    background-size: 100%;
42
     animation-iteration-count: 10;
43
     animation-iteration-count: 10;
43
     animation-duration: 200ms;
44
     animation-duration: 200ms;
44
 }
45
 }

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

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
 <html>
2
 <html>
3
     <head>
3
     <head>
4
         <title>OLC Codejam 2022</title>
4
         <title>OLC Codejam 2022</title>
5
-        <link rel="stylesheet" href="style.css">
5
+        <link rel="stylesheet" href="css/style.css">
6
         <meta charset="utf-8">
6
         <meta charset="utf-8">
7
     </head>
7
     </head>
8
     <body>
8
     <body>
9
         <div id="root">
9
         <div id="root">
10
             <section id="lives"></section>
10
             <section id="lives"></section>
11
         </div>
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
     </body>
18
     </body>
19
 </html>
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
     if (!running) return;
48
     if (!running) return;
49
 
49
 
50
     let directionUpdated = false;
50
     let directionUpdated = false;
51
+    let isOver = false;
51
     Array.from(clouds).forEach(c => {
52
     Array.from(clouds).forEach(c => {
52
         c.update(direction);
53
         c.update(direction);
53
         c.draw();
54
         c.draw();
54
         if (c.x < X_BOUND - 0.01 || c.x > 1.01 - X_BOUND) {
55
         if (c.x < X_BOUND - 0.01 || c.x > 1.01 - X_BOUND) {
55
             directionUpdated = true;
56
             directionUpdated = true;
56
         }
57
         }
58
+        if (c.y >= 0.95) {
59
+            isOver = true;
60
+        }
57
         if (!c.alive) {
61
         if (!c.alive) {
58
             clouds.delete(c);
62
             clouds.delete(c);
59
         }
63
         }
63
         direction = -direction;
67
         direction = -direction;
64
     }
68
     }
65
 
69
 
70
+    if (isOver) {
71
+        gameOver('Game over');
72
+    }
73
+
66
     Array.from(bullets).forEach(b => {
74
     Array.from(bullets).forEach(b => {
67
         b.update();
75
         b.update();
68
         b.draw();
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
 # TODO
1
 # TODO
2
 
2
 
3
 - [x] lives
3
 - [x] lives
4
+- [x] shooting platform sprite
4
 - [ ] clouds should strike lightnings sometimes
5
 - [ ] clouds should strike lightnings sometimes
5
 - [ ] bg rain effect
6
 - [ ] bg rain effect
6
-- [ ] shooting platform sprite
7
 - [ ] boss?
7
 - [ ] boss?
8
 - [ ] umbrella shields
8
 - [ ] umbrella shields
9
 - [ ] music & sounds
9
 - [ ] music & sounds

Loading…
Cancel
Save