Move Image on a slide with Arrow Keys
Hey,
I am trying to make a simple game on captivate. the Idea is that on a slide I inserted an image object and want to move this image if an arrow key is clicked.
I inserted a klickbox and assigned it with a button. If the action was successful I run a Javascript code like below.

Js code:
var moveX = 0, moveY = 0;
const speed = 10;
var w = document.body.clientWidth;
var h = document.body.clientHeight;
var view_W = w - 110;
var view_H = h - 100;
window.addEventListener("keydown", Control);
function Control()
{
let key = event.key;
let figurePicture = document.getElementById('Image_401');
if (key == "ArrowRight" && moveY < view_H)
{
moveY = moveY + speed;
figurePicture.style.bottom = moveY + "px";
figurePicture.style.left = moveX + "px";
}
}
The controle function seems not to. Is there a better way to realise this ?
Any help would be appreciated
