Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refreshGui(){
- let id = 'viewframe';
- createViewFramePositions(`${id}`);
- var elements = document.querySelectorAll(`.${id}`);
- elements.forEach(function(element) {
- if(element){
- let id = element.id.split('_')[0];
- let x = parseInt(element.id.split('_')[1],10);
- let y = parseInt(element.id.split('_')[2],10);
- let z = parseInt(element.id.split('_')[3],10);
- switch (true){
- case (x <= viewConstraints.viewMinX):
- case (x >= viewConstraints.viewMaxX):
- case (y <= viewConstraints.viewMinY):
- case (y >= viewConstraints.viewMaxY):
- switch(z){
- case gui:
- element.style.backgroundImage = `url(http://${host}/GFX/${outOfBoundsCell}.png)`;
- break;
- case shader:
- element.style.backgroundColor = `rgba(255, 0, 0, 0.3)`;
- break;
- }
- break;
- default:
- switch(z){
- case gui:
- case shader:
- element.style.backgroundImage = `url(http://${host}/GFX/${emptyCell}.png)`;
- element.style.backgroundColor = `rgba(0, 0, 0, 0.0)`;
- break;
- }
- break;
- }
- }
- }
- }
- critterAnimateTimer = setInterval(takeTurns, 1500);
- guiAnimateTimer = setInterval(refreshGui, 50);
- // setTimeout(requestAnimationFrame(clock), 1500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement