Skip to content

Commit d3cb2f2

Browse files
committed
watch + livereload implemented
1 parent 028752a commit d3cb2f2

9 files changed

Lines changed: 60 additions & 6 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,6 @@ typings/
6161
.next
6262

6363
# skip dist files
64-
dist
64+
dist
65+
package-lock.json
66+
target/build.js

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# js13k2018
22
Without a code name... yet...
3+
4+
5+
# npm packages
6+
- https://www.npmjs.com/package/nodemon

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('index.js?')

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
"description": "my entry for the #js13k 2018",
55
"main": "index.js",
66
"scripts": {
7-
"concat": "./scripts/concat.sh > dist/build.js"
7+
"concat": "./scripts/concat.sh > target/build.js",
8+
"watch": "nodemon -e js,sh --watch src --watch scripts --exec npm run concat",
9+
"liveserver": "mkdir -p target; cd target; live-server --no-browser",
10+
"start": "npm run watch & npm run liveserver"
811
},
912
"repository": {
1013
"type": "git",
@@ -18,5 +21,9 @@
1821
"bugs": {
1922
"url": "https://github.com/agar3s/js13k2018/issues"
2023
},
21-
"homepage": "https://github.com/agar3s/js13k2018#readme"
24+
"homepage": "https://github.com/agar3s/js13k2018#readme",
25+
"devDependencies": {
26+
"live-server": "^1.2.0",
27+
"nodemon": "^1.18.3"
28+
}
2229
}

scripts/concat.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/bin/bash
22
# original script from @gre
33
# https://github.com/gre/behind-asteroids/blob/master/scripts/concat.sh
4-
4+
echo "// larga vida al #js13k! "
55
# pre
66
cat src/pre.js
77

88
# game
99
cat src/player.js
10+
cat src/canvasRenderer.js
1011
cat src/gameloop.js
1112
cat src/post.js

src/canvasRenderer.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// src/canvasRenderer.js >>>
2+
3+
var canvas = document.getElementById('c');
4+
var graphics = canvas.getContext('2d');
5+
6+
graphics.fillStyle = '#00ff00';
7+
graphics.fillRect(0, 0, 50, 50);

src/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@
3131
</div>
3232
<a href='#' id='f' title='fullscreen'>FullScreen</a>
3333
<script src="../dist/build.js"></script>
34-
<script async src="b.js"></script>
3534
</body>

src/player.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ function Sprite() {
66
x: x,
77
setX: function(newX) {
88
this.x = newX;
9-
console.log('player.x ahora es ', this.x);
109
}
1110
}
1211
}

target/index.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<head>
2+
<title>JS13K 2018 @agar3s</title>
3+
<style>
4+
body{
5+
background:#333;
6+
margin:0;
7+
padding:0;
8+
}
9+
canvas{
10+
}
11+
#c{
12+
background: #fff;
13+
}
14+
#f{
15+
font-family:monospace;
16+
position:absolute;
17+
bottom:10px;
18+
left:10px;
19+
font-size:21px;
20+
color:#993;
21+
text-decoration:none;
22+
}
23+
#f:hover{
24+
color:#9aa;
25+
}
26+
</style>
27+
</head>
28+
<body allowfullscreen>
29+
<div id="d">
30+
<canvas id="c" width="320" height="240"></canvas>
31+
</div>
32+
<a href='#' id='f' title='fullscreen'>FullScreen</a>
33+
<script src="build.js"></script>
34+
</body>

0 commit comments

Comments
 (0)