Drag the background!

Search JS code (of Worlds)

Search JavaScript code of all Worlds for: keycode


User-controlled ...
636 runs ♦ 2 likes
By Starter user  
Created: 12 Feb 2017
Modified: 18 Apr 2021
3d model World. User controlled on desktop. Keyboard arrows to move. Switch to "Move with" camer...
function ourKeys ( event ) { return ( OURKEYS.includes ( event.keyCode ) ); }
if ( event.keyCode == KEY_UP ) // move a bit along angle we are facing
if ( event.keyCode == KEY_LEFT ) // rotate in place
if ( event.keyCode == KEY_RIGHT )
MineCraft
843 runs ♦ 2 likes
By Starter user  
Created: 27 Nov 2016
Modified: 4 Jul 2021
Use keyboard to draw blocks like in MineCraft. Use arrow keys and PgUp, PgDn to draw. Can save w...
function ourKeys ( event ) { return ( OURKEYS.includes ( event.keyCode ) ); }
if ( event.keyCode == 37 ) theobject.position.x = cx - objectsize ; // left
if ( event.keyCode == 39 ) theobject.position.x = cx + objectsize ; // right
if ( event.keyCode == 38 ) theobject.position.z = cz - objectsize ; // forward
if ( event.keyCode == 40 ) theobject.position.z = cz + objectsize ; // back
if ( event.keyCode == 34 ) theobject.position.y = cy - objectsize ;
if ( event.keyCode == 33 ) theobject.position.y = cy + objectsize ;
Touch World
355 runs ♦ 1 like
By Starter user  
Created: 6 Jan 2018
Modified: 18 Apr 2021
How to override default touch handling. Mobile: Touch drag moves agent, touch pinch zooms camera...
function ourKeys ( event ) { return ( OURKEYS.includes ( event.keyCode ) ); }
if ( event.keyCode == 37 ) moveLogicalAgent ( ACTION_LEFT );
if ( event.keyCode == 38 ) moveLogicalAgent ( ACTION_DOWN );
if ( event.keyCode == 39 ) moveLogicalAgent ( ACTION_RIGHT );
if ( event.keyCode == 40 ) moveLogicalAgent ( ACTION_UP );
Zombie Death Baby
561 runs ♦ 1 like
By Starter user  
Created: 11 Jun 2018
Modified: 4 Jul 2021
How to make a fun touch game for mobile. Touch drag and tap objects. Mouse drag and click object...
function ourKeys ( event ) { return ( OURKEYS.includes ( event.keyCode ) ); }
if ( event.keyCode == 37 ) moveAgent ( ACTION_LEFT );
if ( event.keyCode == 38 ) moveAgent ( ACTION_DOWN );
if ( event.keyCode == 39 ) moveAgent ( ACTION_RIGHT );
if ( event.keyCode == 40 ) moveAgent ( ACTION_UP );
Websocket chat
512 runs ♦ 0 likes
By Starter user  
Created: 29 Feb 2020
Modified: 4 Jul 2021
Demo of Ancient Brain Websockets functionality. Run on multiple devices. Chat from one to the other.
document.getElementById('me').onkeydown = function(event) { if (event.keyCode == 13) sendchat(); };
Enhanced Space Pong
220 runs ♦ 0 likes
By Enhanced  
Created: 18 Jun 2018
Modified: 10 May 2019
It's all you want from Pong : smooth controls, different difficulty levels and game modes
if (e.keyCode == 37) player.movement = -1;
if (e.keyCode == 39) player.movement = 1;
if (e.keyCode == 37 && player.movement == -1) player.movement = 0;
else if (e.keyCode == 39 && player.movement == 1) player.movement = 0;
Capture The Egg
79 runs ♦ 0 likes
By tuitef2  
Created: 8 Mar 2019
Modified: 11 Mar 2019
keyboard[event.keyCode] = true;
keyboard[event.keyCode] = false;
Final Pool
979 runs ♦ 2 likes
By Ian Gilligan  
Created: 1 Mar 2019
Modified: 13 Aug 2019
Pool Predictor for CA326
function ourKeys(event) {return(OURKEYS.includes(event.keyCode));}
if ( event.keyCode == 49 ) {selectBall(0);}
else if ( event.keyCode == 50 ) {selectBall(1);}
else if ( event.keyCode == 51 ) {selectBall(2);}
else if ( event.keyCode == 52 ) {selectBall(3);}
Enhanced Don't Move
123 runs ♦ 0 likes
By Enhanced  
Created: 12 Jun 2018
Modified: 27 Jun 2018
Try to dodge cubes as they fall to the ground, in this simple but efficient game
var code = event.keyCode;
Design Your Own ...
4362 runs ♦ 0 likes
By Jack O'Connor  
Created: 18 Feb 2019
Modified: 12 Mar 2019
Design Your Own Room Escape Game
if (keyCode === LEFT_ARROW)
else if (keyCode === RIGHT_ARROW)
if (keyCode === DOWN_ARROW && deg == 360)
FLESHMAN PLAYS G...
4522 runs ♦ 2 likes
By Sean Hutchinson  
Created: 21 Oct 2016
Modified: 10 Feb 2018
if (e.keyCode == 37) // left
if (e.keyCode == 39) // right
if (e.keyCode == 38) // down
if (e.keyCode == 40) // up
if (e.keyCode == 97) // numpad1 is putt
if (e.keyCode == 98) // numpad2 is shot
if (e.keyCode == 99) // numpad3 is drive
Spider Paradise ...
727 runs ♦ 2 likes
By Aisling Casserly  
Created: 8 Dec 2016
Modified: 10 Feb 2018
if (e.keyCode == 37) moveLogicalAgent ( ACTION_LEFT );
if (e.keyCode == 38) moveLogicalAgent ( ACTION_DOWN );
if (e.keyCode == 39) moveLogicalAgent ( ACTION_RIGHT );
if (e.keyCode == 40) moveLogicalAgent ( ACTION_UP );
if (e.keyCode == 65) moveLogicalAgent ( JUMP_LEFT );
if (e.keyCode == 87) moveLogicalAgent ( JUMP_DOWN );
if (e.keyCode == 68) moveLogicalAgent ( JUMP_RIGHT );
if (e.keyCode == 88) moveLogicalAgent ( JUMP_UP );
Don't Move
1259 runs ♦ 2 likes
By Finnian O'Neill  
Created: 6 Dec 2016
Modified: 10 Feb 2018
var code = event.keyCode;
Game of Crowns
1921 runs ♦ 2 likes
By Niamh Byrne  
Created: 16 Nov 2016
Modified: 10 Feb 2018
var code = a.keyCode;
if (e.keyCode == 37) { moveLogicalAgent ( ACTION_LEFT ); e.preventDefault(); }
if (e.keyCode == 38) { moveLogicalAgent ( ACTION_DOWN ); e.preventDefault(); }
if (e.keyCode == 39) { moveLogicalAgent ( ACTION_RIGHT ); e.preventDefault(); }
if (e.keyCode == 40) { moveLogicalAgent ( ACTION_UP ); e.preventDefault(); }
Catch the flag
4264 runs ♦ 2 likes
By Meabh Horan  
Created: 16 Nov 2016
Modified: 10 Feb 2018
if (e.keyCode == 37) moveLogicalAgent ( ACTION_LEFT );
if (e.keyCode == 38) moveLogicalAgent ( ACTION_DOWN );
if (e.keyCode == 39) moveLogicalAgent ( ACTION_RIGHT );
if (e.keyCode == 40) moveLogicalAgent ( ACTION_UP );
if (e.keyCode == 32) moveLogicalAgent ( ACTION_JUMPFORWARD); //cheat code to jump
Looney Tunes Cha...
1357 runs ♦ 2 likes
By Sean Sinnott  
Created: 16 Nov 2016
Modified: 10 Feb 2018
if (e.keyCode == 37)
if (e.keyCode == 38)
if (e.keyCode == 39)
if (e.keyCode == 40)
if (e.keyCode == 83)
Coding Challenge 3
20 runs ♦ 0 likes
By "Coding Train" p...  
Created: 4 Sep 2018
Modified: 4 Sep 2018
The Snake Game
if (keyCode === UP_ARROW) {
} else if (keyCode === DOWN_ARROW) {
} else if (keyCode === RIGHT_ARROW) {
} else if (keyCode === LEFT_ARROW) {
Snake game
4 runs ♦ 0 likes
By P5 Editor portin...  
Created: 20 Jun 2021
Modified: 7 Jul 2021
The famous snake game! Once you click run, click anywhere * inside the black area, and control ...
switch (keyCode) {
Camera
27 runs ♦ 0 likes
By threejs.org port...  
Created: 1 Jul 2021
Modified: 15 Jul 2021
Creates a basic camera angles with thrre.js from the three.js examples
switch ( event.keyCode ) {
Game
228 runs ♦ 0 likes
By Alex Murphy  
Created: 10 Apr 2019
Modified: 23 Apr 2019
Game
if (keyCode === LEFT_ARROW) {
else if (keyCode === RIGHT_ARROW) {
First Person Con...
63 runs ♦ 0 likes
By Mathias Bazin  
Created: 13 Jun 2018
Modified: 10 May 2019
First person view with mouse controls. Use WASD or Arrows to move, mouse to look around and spac...
switch ( event.keyCode ) {
switch( event.keyCode ) {
Cloned Don't Move
60 runs ♦ 0 likes
By SinfulSalad  
Created: 11 Jun 2018
Modified: 11 Jun 2018
Clone of "Don't Move" by Finnian O'Neill
var code = event.keyCode;
Cool light
10 runs ♦ 0 likes
By Mathias Bazin  
Created: 20 Jun 2018
Modified: 10 May 2019
Clone of "First Person Night" by Mathias Bazin
switch ( event.keyCode ) {
switch( event.keyCode ) {
Infinite World - V1
721 runs ♦ 2 likes
By Nathan Bonnard  
Created: 13 Jun 2018
Modified: 13 Aug 2018
Infinite world, with nice landscapes, trees and castle by Nathan Bonnard
if((e.keyCode == 38) || (e.keyCode == 40))
if(e.keyCode == 37 || e.keyCode == 39)
if(e.keyCode == 37 || e.keyCode == 39)
switch ( event.keyCode ) {
switch( event.keyCode ) {
Cloned FLESHMAN ...
7 runs ♦ 0 likes
By Nathan Bonnard  
Created: 5 Jun 2018
Modified: 5 Jun 2018
Clone of "FLESHMAN PLAYS GOLF (NumPad 1, 2 & 3 to hit ball)" by Sean Hutchinson
if (e.keyCode == 37) // left
if (e.keyCode == 39) // right
if (e.keyCode == 38) // down
if (e.keyCode == 40) // up
if (e.keyCode == 97) // numpad1 is putt
if (e.keyCode == 98) // numpad2 is shot
if (e.keyCode == 99) // numpad3 is drive
No Grid Game of ...
15 runs ♦ 0 likes
By Mathias Bazin  
Created: 15 Jun 2018
Modified: 18 Jun 2018
get rid of the grid
var code = a.keyCode;
if (e.keyCode == 37) { moveLogicalAgent ( ACTION_LEFT ); e.preventDefault(); }
if (e.keyCode == 38) { moveLogicalAgent ( ACTION_DOWN ); e.preventDefault(); }
if (e.keyCode == 39) { moveLogicalAgent ( ACTION_RIGHT ); e.preventDefault(); }
if (e.keyCode == 40) { moveLogicalAgent ( ACTION_UP ); e.preventDefault(); }
Cloned Cloned Mi...
24 runs ♦ 0 likes
By SinfulSalad  
Created: 31 May 2018
Modified: 31 May 2018
Clone of "Cloned Minecraft with cursor + better camera" by Nathan Bonnard
if ( e.keyCode == leftInput ) { cursor.position.x += - objectsize ; e.preventDefault(); } // left
if ( e.keyCode == rightInput ) { cursor.position.x += + objectsize ; e.preventDefault(); } // right
if ( e.keyCode == forwardInput ) { cursor.position.z += - objectsize ; e.preventDefault(); } // forward
if ( e.keyCode == backwardInput ) { cursor.position.z += + objectsize ; e.preventDefault(); } // back
if ( e.keyCode == bottomInput ) { cursor.position.y += - objectsize ; e.preventDefault(); }
if ( e.keyCode == topInput ) { cursor.position.y += + objectsize ; e.preventDefault(); }
if ( e.keyCode == 13 ) { // Enter key pressed
if ( e.keyCode == 46 ) { //delete button pressed
Cloned Touch complex
7 runs ♦ 0 likes
By Nathan Bonnard  
Created: 18 Jun 2018
Modified: 18 Jun 2018
Clone of "Touch complex" by Starter user
if (e.keyCode == 37) { moveLogicalAgent ( ACTION_LEFT ); e.preventDefault(); }
if (e.keyCode == 38) { moveLogicalAgent ( ACTION_DOWN ); e.preventDefault(); }
if (e.keyCode == 39) { moveLogicalAgent ( ACTION_RIGHT ); e.preventDefault(); }
if (e.keyCode == 40) { moveLogicalAgent ( ACTION_UP ); e.preventDefault(); }
Enhanced Game of...
26 runs ♦ 0 likes
By Mathias Bazin  
Created: 13 Jun 2018
Modified: 20 Jun 2018
Added better controls that adjust dynamically with the camera view, fireball kills on touch, coh...
var code = a.keyCode;
if (e.keyCode == leftInput) { moveLogicalAgent ( ACTION_LEFT ); e.preventDefault(); }
if (e.keyCode == backwardInput) { moveLogicalAgent ( ACTION_DOWN ); e.preventDefault(); }
if (e.keyCode == rightInput) { moveLogicalAgent ( ACTION_RIGHT ); e.preventDefault(); }
if (e.keyCode == forwardInput) { moveLogicalAgent ( ACTION_UP ); e.preventDefault(); }
First Person Night
47 runs ♦ 0 likes
By Mathias Bazin  
Created: 19 Jun 2018
Modified: 10 May 2019
It's night
switch ( event.keyCode ) {
switch( event.keyCode ) {


The background is a program, showing the JavaScript graphics used on this site.
The globes light up when you log in.
 
Font:

Website copyright Ancient Brain. 2018-2021.
Users retain ownership of user content.

Platforms      Stats      The name      Terms and conditions

Call for partners      Contact

Call for partners!
If you are interested in writing a programming course, textbook or tutorial videos, Ancient Brain is looking for partners. We will work with you, and integrate your course into the site. This is an opportunity for someone looking to develop a course or textbook to partner with a site to support it and promote it.