Pryme8 Posted August 15, 2016 Share Posted August 15, 2016 http://pryme8.github.io/TERIABLE/infinity.html I figured this line of script would have fixed this: window.onkeydown = function(e) { return !(e.keyCode == 32 || e.keyCode == 17 || e.keyCode == 91); }; The controls for right now are WSAD ctrl and space. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 15, 2016 Author Share Posted August 15, 2016 this solves the save shortcut, but not the ctrl+w to close tab shortcut $(window).keypress(function(event) { event.preventDefault(); return false; }); I really need to figure out how to stop the tab from closing when a user crouches with ctrl and try to move forward. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 16, 2016 Share Posted August 16, 2016 Hi @Pryme8 I got this from stackoverflow a while back, i don't have a link though. window.onbeforeunload = function () {//Prevent Ctrl+W in chrome return "Really want to quit the game?"; }; document.onkeydown = function (e) { e = e || window.event;//Get event if (e.ctrlKey) { var c = e.which || e.keyCode;//Get key code switch (c) { case 83://Block Ctrl+S case 87://Block Ctrl+W --Not work in Chrome e.preventDefault(); e.stopPropagation(); break; } } }; Update; To my understanding, no matter what you do, Chrome reserves Ctrl + W for tab closing and it cannot be stopped, chrome ignores your javascript, the above solution by using onbeforeunload is the only way to avoid it closing the tab imitiately, but ofc it will make a popup window instead, so i would suggest allowing other keys to be used. Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 16, 2016 Share Posted August 16, 2016 @Pryme8 - it appears you have an artifact which is redrawing the sphere onto your canvas which appears quite tiny in the center of your screen. If what I'm seeing is indeed an artifact which is not meant to be drawn, then you might want to update your camera. I haven't reviewed your code, but if this is an artifact which you do not want to be drawn, then using .updateCamera(); in reference to your SpriteRoot class object(s) should do the trick. But I'll assume that you already know this, so please ignore if it's simply not an issue. Obviously, I just took a quick look at your link, and thought I'd offer up my obvious first thoughts; just to make me look smart. Cheers, DB Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 16, 2016 Author Share Posted August 16, 2016 It's there as a reference point, besides the bigger sphere, once there is more then just flat nothing it will be removed Quote Link to comment Share on other sites More sharing options...
dbawel Posted August 16, 2016 Share Posted August 16, 2016 @Pryme8 - Again, I assumed this probably had a purpose. I only thought to mention this as I saw this in other posts you currently have online and thought it might be a common artifact which many users overlook. So please ignore my "ever so wise" observation which obviously isn't an issue. Cheers, DB Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.