Mode:
Duration:
1
2
3
4
document.addEventListener('keydown', function(e) {
if (e.key === 'ArrowRight') sprite.x += 10;
if (e.key === 'ArrowLeft') sprite.x -= 10;
});Coding works best on desktop or with an external keyboard.
document.addEventListener('keydown', function(e) {
if (e.key === 'ArrowRight') sprite.x += 10;
if (e.key === 'ArrowLeft') sprite.x -= 10;
});Coding works best on desktop or with an external keyboard.
A Blockly example where arrow-key input moves a sprite. Code shown is the JavaScript Blockly would generate.
document.addEventListener('keydown', function(e) {
if (e.key === 'ArrowRight') sprite.x += 10;
if (e.key === 'ArrowLeft') sprite.x -= 10;
});Blockly is an open-source visual block-based programming library developed by Google. It allows developers to embed a drag-and-drop block coding editor inside web or mobile apps, enabling users to create logic visually without writing text code.
Origin & Creator
Blockly was developed by Google starting in 2012 as part of efforts to improve accessible programming through block-based UIs.
Industrial Note
Blockly is widely used in educational tools, IoT dashboards, no-code editors, robotics environments, and enterprise workflow builders where a visual logic editor is needed.