aboutsummaryrefslogtreecommitdiff
path: root/src/sim/static/tiles.js
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2020-05-13 10:53:44 -0500
committerMark Powers <markppowers0@gmail.com>2020-05-13 10:53:44 -0500
commit1855e0c673b06399ca89aa0c705d30b1a9ea3b97 (patch)
tree2c78eceab67bc2f377449a25df7f87181876070b /src/sim/static/tiles.js
parenta5706caa9cd91e357085d77c62aff7107ac76fc1 (diff)
Add sim and paperflight games
Diffstat (limited to 'src/sim/static/tiles.js')
-rw-r--r--src/sim/static/tiles.js73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/sim/static/tiles.js b/src/sim/static/tiles.js
new file mode 100644
index 0000000..5b31d19
--- /dev/null
+++ b/src/sim/static/tiles.js
@@ -0,0 +1,73 @@
+function Mountain() {
+ this.name = "mountain"
+}
+Mountain.prototype.draw = function (x, y, size) {
+ ctx.fillStyle = "gray"
+ ctx.beginPath();
+ ctx.moveTo(x * size + size / 2, y * size);
+ ctx.lineTo(x * size, (1 + y) * (size));
+ ctx.lineTo((1 + x) * (size), (1 + y) * (size));
+ ctx.stroke();
+ ctx.fill();
+}
+Mountain.prototype.update = function () {
+ var event = undefined
+ if(Math.random() < 0.1){
+ event = function(){
+
+ }
+ }
+ return {
+ gold: 1,
+ event: event
+ }
+}
+
+function Forest() {
+ this.name = "forest"
+}
+Forest.prototype.draw = function (x, y, size) {
+ ctx.fillStyle = "green"
+ ctx.beginPath();
+ ctx.moveTo(x * size + size / 2, y * size);
+ ctx.lineTo(x * size, (1 + y) * (size));
+ ctx.lineTo((1 + x) * (size), (1 + y) * (size));
+ ctx.stroke();
+ ctx.fill();
+}
+Forest.prototype.update = function () {
+ var event = {}
+ if(Math.random() < 0.1){
+ event.status = "A tree monster taks half of your"
+ }
+ return {
+ resources: Math.floor(Math.random() * 5),
+ event: event
+ }
+}
+
+function Town() {
+ this.name = "town"
+}
+Town.prototype.draw = function (x, y, size) {
+ ctx.fillStyle = "brown"
+ ctx.stokeStyle = "brown"
+ ctx.beginPath();
+ ctx.moveTo(x * size + size / 2, y * size);
+ ctx.lineTo(x * size, (1 + y) * (size));
+ ctx.lineTo((1 + x) * (size), (1 + y) * (size));
+ ctx.stroke();
+ ctx.fill();
+}
+Town.prototype.update = function () {
+ var event = undefined
+ if(Math.random() < 0.1){
+ event = function(){
+
+ }
+ }
+ return {
+ population: Math.floor(Math.random() * 4) - 1,
+ event: event
+ }
+}