Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Please add this script to an at start of layout event For all future games. It will make it so that the screen wont scroll when you push up or down.

function $(){ return document.querySelector.apply(document,arguments);

}

var canvas = $('canvas'),

 keysDown = []; // You can also define this as an object, {}

canvas.tabIndex = 0;

canvas.onclick = function(e){

 document.body.scrollTop = canvas.offsetTop; // scrolls to canvas element

 canvas.focus(); // re-focuses canvas in case the scroll unfocused it

}

canvas.onkeydown = canvas.onkeyup = function(e){

 keysDown[e.keyCode] = e.type == 'keydown';

 e.preventDefault();

 return false;

}

function isDown(key){

 return keysDown[key];

}

function resetMap(){

 keysDown = [];

 return false;

}

Am i supposed to add things on the script ? because it doesnt work. try with " keypress " too. I am not into script, i do only events.

it should just work if you paste it in? It works for all of my stuff

it doesnt :(-

hmm give me a day or so because it totally improves construct games