1 decade ago by saloon12yrd
Hi all,
I've run into a strange issue that I can't explain.
My index.html has the usual #canvas element for the game and below that another div (#controls) which contains elements such as the health display etc.
The index.html includes an additional hud.js which does little less than binding all the GUI elements to a JS object:
I refer to that Hud object in my game entities whenever they need updating. This works flawlessly in the game itself but Weltmeister refuses to load the levels and 'hangs'.
I assumed this is because the Hud object is not present (since it is created in a js file Weltmeister doesn't include) but sometimes accessed in the entities' init() method but even if I do
Weltmeister won't load the levels.
Any hints how to solve this?
Thanks
I've run into a strange issue that I can't explain.
My index.html has the usual #canvas element for the game and below that another div (#controls) which contains elements such as the health display etc.
The index.html includes an additional hud.js which does little less than binding all the GUI elements to a JS object:
$(document).ready(function() { [...] Hud = { health: $('#healthGui'), currentWeapon: $('#currentWeaponGui'), ammo: { rocket: $('#ammoRocketsGui'), plasma: $('#ammoPlasmaGui'), crypto: $('#ammoCryptoGui'), ionizer: $('#ammoIonGui') } }; [...] });
I refer to that Hud object in my game entities whenever they need updating. This works flawlessly in the game itself but Weltmeister refuses to load the levels and 'hangs'.
I assumed this is because the Hud object is not present (since it is created in a js file Weltmeister doesn't include) but sometimes accessed in the entities' init() method but even if I do
init: function(x, y, settings) { [...] // update the HUD if (Hud != null) { Hud.health.text(this.health); [...] },
Weltmeister won't load the levels.
Any hints how to solve this?
Thanks