Working through http://buildnewgames.com/introduction-to-crafty/
This commit is contained in:
parent
70a169c5c6
commit
62b889772c
5
.gitignore
vendored
5
.gitignore
vendored
@ -4,3 +4,8 @@
|
||||
/arduino/libraries/*
|
||||
.dep
|
||||
*.hex
|
||||
|
||||
intro-to-crafty/lib/crafty.js
|
||||
intro-to-crafty/assets/*
|
||||
intro-to-crafty/crafty_bng_tut_assets*
|
||||
__MACOSX
|
||||
|
22
intro-to-crafty/Makefile
Normal file
22
intro-to-crafty/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
INTRO_ASSETS_ZIP := crafty_bng_tut_assets.zip
|
||||
INTRO_ASSETS_EXTRACTED_README := crafty_bng_tut_assets/README
|
||||
|
||||
.PHONY: all
|
||||
all: lib/crafty.js assets/README
|
||||
|
||||
.PHONY: serve
|
||||
serve:
|
||||
python3 -m http.server
|
||||
|
||||
lib/crafty.js:
|
||||
curl -sSL -o $@ http://craftyjs.com/release/0.5.3/crafty.js
|
||||
|
||||
assets/README: $(INTRO_ASSETS_EXTRACTED_README)
|
||||
rsync -av $(dir $(INTRO_ASSETS_EXTRACTED_README))/ assets/
|
||||
|
||||
$(INTRO_ASSETS_EXTRACTED_README): $(INTRO_ASSETS_ZIP)
|
||||
unzip $(INTRO_ASSETS_ZIP)
|
||||
find $(dir $(INTRO_ASSETS_EXTRACTED_README)) -type f | xargs touch
|
||||
|
||||
$(INTRO_ASSETS_ZIP):
|
||||
curl -sSL -o $@ http://buildnewgames.com/assets/article//introduction-to-crafty/crafty_bng_tut_assets.zip
|
0
intro-to-crafty/assets/.gitkeep
Normal file
0
intro-to-crafty/assets/.gitkeep
Normal file
12
intro-to-crafty/index.html
Normal file
12
intro-to-crafty/index.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="lib/crafty.js"></script>
|
||||
<script src="src/game.js"></script>
|
||||
<script>
|
||||
window.addEventListener('load', Game.start);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
6
intro-to-crafty/src/game.js
Normal file
6
intro-to-crafty/src/game.js
Normal file
@ -0,0 +1,6 @@
|
||||
Game = {
|
||||
start: function() {
|
||||
Crafty.init(480, 320);
|
||||
Crafty.background('green');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user