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);
    }
}

Last updated

Was this helpful?