Skip to content

Commit

Permalink
add js scripts init
Browse files Browse the repository at this point in the history
  • Loading branch information
s.kushnirenko committed Sep 24, 2023
1 parent 54acfa0 commit 07672f0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/scripts/math.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Math.clamp = function (a, b, c) {
return Math.max(b, Math.min(c, a));
}

Math.randomIndex = function(min, max) {
var offset = min;
var range = (max - min) + 1;

var randomNumber = Math.floor( Math.random() * range) + offset;
return randomNumber;
}

Math.percentage = function(value, base) {
return Math.floor(value / base * 100);
}

log_info("!!! Module Math Loaded")

11 changes: 11 additions & 0 deletions src/scripts/modules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
log_info("Ozymandias: load modules started")

var modules = [
"math",
// "main_menu"
]

for (var i in modules) {
log_info("Loading module " + modules[i])
load_js_module(":" + modules[i] + ".js")
}

0 comments on commit 07672f0

Please sign in to comment.