espace Posted November 6, 2016 Share Posted November 6, 2016 Hi, On this links i see how put a background image directly on the index.html https://github.com/EnclaveGames/Cyber-Orb/blob/gh-pages/index.html <style> body { margin: 0; background: #2B2E31 url(img/screen-bg.png) How do you the same with different stage ? Link to comment Share on other sites More sharing options...
Tom Atom Posted November 6, 2016 Share Posted November 6, 2016 Hi, if you mean how to change it dynamically, then you can do this from code: // add styles var bodyStyle = document.getElementById("body").style; bodyStyle.backgroundImage = "url('assets/pattern.png')"; bodyStyle.backgroundRepeat = "repeat"; Link to comment Share on other sites More sharing options...
espace Posted November 7, 2016 Author Share Posted November 7, 2016 Thanks Tom Atom, i would means that with this code, i could for example in my "playtitle.js" have one background image and in my "thegame.js" have another background image. Link to comment Share on other sites More sharing options...
Recommended Posts