Cursor input
#HelloGameDev #HelloErmine #HelloWorld2021
Cursor input
āļāļ·āļ āļāļēāļĢāļāļ§āļāļāļļāļĄāļāļąāļ§āļĨāļ°āļāļĢāļāļāļāđāļĢāļēāļāđāļ§āļĒ cursor āļāļĢāļ°āļĄāļēāļāļ§āđāļēāđāļāđāļāļļāđāļĄāļĨāļđāļāļĻāļĢāļāļąāļāļāļąāļāđāļāļ·āđāļāđāļŦāđāļāļąāļ§āļĨāļ°āļāļĢāđāļāļīāļāđāļāļāļēāļĄāļāļĩāđāđāļĢāļēāđāļĨāļ·āļāļ āđāļāļĒāđāļāđāļāļģāļŠāļąāđāļ
cursor = this.input.keyboard.createCursorKeys();
āļāļąāļ§āļāļĒāđāļēāļ
create(){
cursor = this.input.keyboard.createCursorKeys();
}
update(){
if(cursor.up.isDown){
player.setVelocityY(-500);
}else if(cursor.down.isDown){
player.setVelocityY(500);
}else{
player.setVelocityY(0);
}
if(cursor.left.isDown){
player.setVelocityX(-500);
}else if(cursor.right.isDown){
player.setVelocityX(500);
}else{
player.setVelocityX(0);
}
}
Cursor input āļāļ°āđāļŦāļĄāļ·āļāļāļāļąāļ Key input āđāļāđāđāļĄāđāļŠāļēāļĄāļēāļĢāļāļāļģāļŦāļāļāļāļļāđāļĄāļāļ·āđāļāļāļāļāļāļēāļāļĨāļđāļāļĻāļĢāđāļāđ
Last updated
Was this helpful?