Button Input for Object Position


#1

What would a string of code attached to a clip look like if I wanted to have the arrow keys (or any key really) as input to move a clip around? I can’t seem to get the code to run with a key as an input.


#2

Never mind I figured it out!!!

function update() {
if(keyIsDown(‘RIGHT’)) {
this.x +=5
}
if(keyIsDown(‘LEFT’)) {
this.x -=5
}
if(keyIsDown(‘UP’)) {
this.y -=5
}
if(keyIsDown(‘DOWN’)) {
this.y +=5
}

}


#3

Cool stuff - feel free to post here anytime if you need more help~

Also, I just realized there’s no example for arrow keys movement in the examples page, I’ll probably make one soon with pretty much the same code as yours