Drag the background!

Search source code (of Worlds)

Search JavaScript code of all Worlds for: keycode


Super Mario Maze
2293 runs ♦ 4 likes
By Cathal Neary  
Created: 19 Nov 2016
Modified: 17 Sep 2023
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(); }
if (e.keyCode == 32) { moveLogicalAgent ( ACTION_JUMP ); e.preventDefault(); }
First Person Con...
234 runs ♦ 0 likes
By Enhanced  
Created: 21 Jun 2018
Modified: 17 Sep 2023
First person view with mouse controls. Use WASD or Arrows to move, mouse to look around and spac...
switch ( event.keyCode ) {
switch( event.keyCode ) {
Final Pool
1228 runs ♦ 2 likes
By Ian Gilligan  
Created: 1 Mar 2019
Modified: 17 Sep 2023
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);}
FLESHMAN PLAYS G...
4634 runs ♦ 2 likes
By Sean Hutchinson  
Created: 21 Oct 2016
Modified: 17 Sep 2023
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
Bomberman
321 runs ♦ 0 likes
By Enhanced  
Created: 21 Jun 2018
Modified: 17 Sep 2023
Classic game of Bomberman, try to kill the ennemy with a bomb !
if (e.keyCode == 32)
if (e.keyCode == 37)
if (e.keyCode == 38)
if (e.keyCode == 39)
if (e.keyCode == 40)
Looney Tunes Cha...
1456 runs ♦ 2 likes
By Sean Sinnott  
Created: 16 Nov 2016
Modified: 17 Sep 2023
if (e.keyCode == 37)
if (e.keyCode == 38)
if (e.keyCode == 39)
if (e.keyCode == 40)
if (e.keyCode == 83)
Game of Crowns s...
225 runs ♦ 0 likes
By Enhanced  
Created: 21 Jun 2018
Modified: 17 Sep 2023
Enhanced version of "Game of Crowns" by Niamh Byrne with better graphics and controls
var code = a.keyCode;
if (e.keyCode == 37) { moveLogicalAgent ( ACTION_LEFT ); e.preventDefault(); }
if (e.keyCode == 40) { moveLogicalAgent ( ACTION_DOWN ); e.preventDefault(); }
if (e.keyCode == 39) { moveLogicalAgent ( ACTION_RIGHT ); e.preventDefault(); }
if (e.keyCode == 38) { moveLogicalAgent ( ACTION_UP ); e.preventDefault(); }
Touch World
485 runs ♦ 1 like
By Starter user  
Created: 6 Jan 2018
Modified: 17 Sep 2023
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 );
Infinite World O...
104 runs ♦ 0 likes
By Enhanced  
Created: 16 Aug 2018
Modified: 17 Sep 2023
Here is a code to get an infinite world that loop without object in it, without the sun
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 ) {
Design Your Own ...
4436 runs ♦ 0 likes
By Jack O'Connor  
Created: 18 Feb 2019
Modified: 17 Sep 2023
Design Your Own Room Escape Game
if (keyCode === LEFT_ARROW)
else if (keyCode === RIGHT_ARROW)
if (keyCode === DOWN_ARROW && deg == 360)
3D Snake
647 runs ♦ 1 like
By przemek biel  
Created: 29 Nov 2022
Modified: 17 Sep 2023
snake eats apple nom nom but in 3D
switch (e.keyCode){
Battleship
4332 runs ♦ 2 likes
By Aaron Crawford  
Created: 30 Oct 2022
Modified: 17 Sep 2023
if (e.keyCode == '38')
else if (e.keyCode == '40')
else if (e.keyCode == '37')
else if (e.keyCode == '39')
else if (e.keyCode == '13')
Rythm of the night
310 runs ♦ 0 likes
By Enhanced  
Created: 2 Aug 2018
Modified: 17 Sep 2023
A rythm game where you have to use the right inputs at the right time to progress from one level...
//it can take the values 38 to 41. The html keycode of the arrow keys goes
if (e.keyCode == 37 || e.keyCode == 38 || e.keyCode == 39 || e.keyCode == 40)
if (actionRequired !== undefined && e.keyCode == obstacles[actionRequired])
//by the keycode of that arrow)(70% of the time) either nothing (represented
Globe Trotter
1520 runs ♦ 2 likes
By Laura Araviciute  
Created: 3 Dec 2016
Modified: 17 Sep 2023
var code = event.keyCode;
Chess
5904 runs ♦ 2 likes
By Eoin Daly  
Created: 19 Oct 2022
Modified: 17 Sep 2023
A game of chess by the beach, on a beautiful day
if (event.keyCode == 37) // If the left arrow is clicked then move the selector left
else if (event.keyCode == 38) // If the up arrow is clicked then move the selector up
else if (event.keyCode == 39) // If the right arrow is clicked then move the selector right
else if (event.keyCode == 40) // If the down arrow is clicked then move the selector down
else if (event.keyCode == 13) // If the Enter key is clicked then check what the user wants
Mighty Spread
344 runs ♦ 0 likes
By Gareth Hogan  
Created: 12 Nov 2022
Modified: 17 Sep 2023
CA318 Project
return(OURKEYS.includes(event.keyCode));
if(event.keyCode == 65) socketSender(ACTION_LEFT, 1);
if(event.keyCode == 87) socketSender(ACTION_DOWN, 1);
if(event.keyCode == 68) socketSender(ACTION_RIGHT, 1);
if(event.keyCode == 83) socketSender(ACTION_UP, 1);
Space Plane Shooter
868 runs ♦ 2 likes
By Brian Kilduff  
Created: 26 Nov 2016
Modified: 17 Sep 2023
if (e.keyCode == 37) moveLogicalAgent ( ACTION_LEFT ); //left arrow key
if (e.keyCode == 38 && jump1 == false) //up arrow key
if (e.keyCode == 39) moveLogicalAgent ( ACTION_RIGHT ); //right arrow key
if (e.keyCode == 66) moveLogicalAgent ( ACTION_DOWN ); //"b"key
if (e.keyCode == 32) //speace bar key fires bullets
Infinite World G...
152 runs ♦ 0 likes
By Enhanced  
Created: 16 Aug 2018
Modified: 17 Sep 2023
Here is a code to get an infinite world that loop without object in it, and with the sun
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 ) {
Websocket chat
1076 runs ♦ 0 likes
By Starter user  
Created: 29 Feb 2020
Modified: 17 Sep 2023
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(); };
Catch the flag
4368 runs ♦ 2 likes
By Meabh Horan  
Created: 16 Nov 2016
Modified: 17 Sep 2023
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
Competitive Hangman
440 runs ♦ 2 likes
By David Jusev  
Created: 5 Dec 2022
Modified: 17 Sep 2023
Play hangman against friends. Multi-user port of https://codingartistweb.com/2022/05/hangman-gam...
document.getElementById('me').onkeydown = function(event) { if (event.keyCode == 13) sendchat(); };
Shooting Range (...
2372 runs ♦ 4 likes
By Adrian Rabbitte  
Created: 16 Nov 2016
Modified: 17 Sep 2023
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) // if the keycode is space.
Game of Crowns
2610 runs ♦ 2 likes
By Niamh Byrne  
Created: 16 Nov 2016
Modified: 17 Sep 2023
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(); }
Don't Move
1339 runs ♦ 2 likes
By Finnian O'Neill  
Created: 6 Dec 2016
Modified: 17 Sep 2023
var code = event.keyCode;
Pacman
306 runs ♦ 0 likes
By Enhanced  
Created: 21 Jun 2018
Modified: 17 Sep 2023
Enhanced version of Game Pacman in Space, you need to collect all white bullet to end the game, ...
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 );
Complex World
8556 runs ♦ 5 likes
By Starter user  
Created: 1 Oct 2016
Modified: 17 Sep 2023
World with a Mind-controlled agent, actively-pursuing enemy, random maze, skybox, music.
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 );
Spider Paradise ...
777 runs ♦ 2 likes
By Aisling Casserly  
Created: 8 Dec 2016
Modified: 17 Sep 2023
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 );
Romantic Sunset
252 runs ♦ 0 likes
By Enhanced  
Created: 17 Aug 2018
Modified: 17 Sep 2023
Turn your head and discover a eautiful scenery observable in first person mode.
switch ( event.keyCode ) {
switch( event.keyCode ) {
Lion Chase
496 runs ♦ 0 likes
By Martin Derwin  
Created: 30 Nov 2022
Modified: 17 Sep 2023
Don't get caught by the lions
return(OURKEYS.includes(event.keyCode));
if(event.keyCode == KEY_A) sendData(KEY_A, 2);
if(event.keyCode == KEY_W) sendData(KEY_W, 2);
if(event.keyCode == KEY_D) sendData(KEY_D, 2);
if(event.keyCode == KEY_LEFT)
Cook A Long
301 runs ♦ 1 like
By Joseph Adeosun  
Created: 3 Dec 2022
Modified: 17 Sep 2023
Attempted port of "Chicken Alfredo Cooking Game" by Emily Cerequas and Jenny Kowalski. https://q...
document.getElementById('me').onkeydown = function(event) { if (event.keyCode == 13) sendchat(); };
Find Woody's Hat
613 runs ♦ 1 like
By Benjamin Olojo  
Created: 4 Dec 2022
Modified: 11 Sep 2024
Clone of "Capture the Hat" by Tuomas Bazzan
if (e.keyCode == 37) moveLogicalAgent ( ACTION_LEFT );
else if (e.keyCode == 38) moveLogicalAgent ( ACTION_DOWN );
else if (e.keyCode == 39) moveLogicalAgent ( ACTION_RIGHT );
else if (e.keyCode == 40) moveLogicalAgent ( ACTION_UP );
else if (e.keyCode == 17) moveLogicalAgent ( ACTION_PAUSE ); // ctrl to mute
Zombie Death Baby
860 runs ♦ 1 like
By Starter user  
Created: 11 Jun 2018
Modified: 17 Sep 2023
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 );
Run Run Run!
5775 runs ♦ 3 likes
By Duarte Martinho  
Created: 15 Nov 2022
Modified: 17 Sep 2023
CA318 Project by Duarte Martinho and Rion Xheladini. Modified port of "Crossy Road" by Hunor Mar...
if (event.keyCode == '38' || event.keyCode == '87') {
else if (event.keyCode == '40' || event.keyCode == '83') {
else if (event.keyCode == '37' || event.keyCode == '65') {
else if (event.keyCode == '39' || event.keyCode == '68') {
else if (event.keyCode == '77') {
3D Platform Game
260 runs ♦ 0 likes
By Ronghui  
Created: 5 Dec 2022
Modified: 17 Sep 2023
Race to the End! WASD to move.
keyboard[event.keyCode] = true;
keyboard[event.keyCode] = false;
Capture The Egg
138 runs ♦ 0 likes
By tuitef2  
Created: 8 Mar 2019
Modified: 17 Sep 2023
keyboard[event.keyCode] = true;
keyboard[event.keyCode] = false;
Minecraft Builder
301 runs ♦ 0 likes
By Enhanced  
Created: 5 Jun 2018
Modified: 17 Sep 2023
Build your own worlds. Enhanced version of the Minecraft starter world with added control and co...
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(); }
Enhanced Space Pong
1029 runs ♦ 0 likes
By Enhanced  
Created: 18 Jun 2018
Modified: 17 Sep 2023
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;
Interstellar cubes
734 runs ♦ 3 likes
By Thomas Mc Cann  
Created: 16 Oct 2019
Modified: 17 Sep 2023
A journey into Interstellar space. Run and press F12 (in chrome) to view the console. Try left c...
var key = event.which || event.keyCode; // Use either which or keyCode, depending on browser support
User-controlled ...
1083 runs ♦ 2 likes
By Starter user  
Created: 12 Feb 2017
Modified: 17 Sep 2023
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 )
Zombie Escape
4140 runs ♦ 6 likes
By Liam  
Created: 30 Nov 2022
Modified: 17 Sep 2023
Compete with another player to see who can survive the longes against a hoard of zombies!
function ourKeys ( event ) { return ( OURKEYS.includes ( event.keyCode ) ); }
if ( event.keyCode == KEY_UP || event.keyCode == KEY_W) // if the Up arrow or W key is pressed.
if ( event.keyCode == KEY_DOWN || event.keyCode == KEY_S) // if the down arrow or S key is pressed.
if ( event.keyCode == KEY_LEFT || event.keyCode == KEY_A) // if the left arrow or A key is pressed.
if ( event.keyCode == KEY_RIGHT || event.keyCode == KEY_D) // if the right arrow or D key is pressed.


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

Users retain ownership of user content.

Platforms      Stats      The name      Terms and conditions

Call for partners      Contact

Call for partners!
Ancient Brain is looking for a partner to co-write a JavaScript or Python coding book for schools, to be used worldwide. This would be a course for students in learning to code from scratch. The book and course will be integrated into the Ancient Brain site. This is an opportunity for someone looking to develop a course and textbook to partner with a site to promote it. Read more.