diff --git a/src/helpers.js b/src/helpers.js new file mode 100644 index 0000000..d1ef486 --- /dev/null +++ b/src/helpers.js @@ -0,0 +1,3 @@ +export function random_number(min, max) { + Math.floor((Math.random() * max) + min); +}; diff --git a/src/index.html b/src/index.html index 8e03703..4fe85cc 100644 --- a/src/index.html +++ b/src/index.html @@ -8,6 +8,7 @@ diff --git a/src/main.js b/src/main.js index bd9d65a..098b7c0 100644 --- a/src/main.js +++ b/src/main.js @@ -1,8 +1,11 @@ +import random_number from './helpers'; + class Engine { constructor() { this.ticks = 0; this.resources = { - dust: 0 + dust: 0, + crystals: 0 } } @@ -27,8 +30,15 @@ class Player { } } +class Asteroid { + mine_resource() { + console.log(random_number(2, 10)); + } +} + var engine = new Engine(); var player = new Player(engine); +var current_asteroid = new Asteroid(); var bootstrap = function() { setInterval(() => {