Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const config = {
- width: 500,
- height: 300,
- type: Phaser.AUTO,
- physics: {
- default: 'arcade',
- arcade: {
- gravity: {y: 450}
- }
- },
- scene: {
- preload: preload,
- create: create,
- update: update
- }
- }
- var game = new Phaser.Game (config)
- let bob
- let cursors
- function preload() {
- this.load.image('bob', 'oui/bob.png')
- }
- function create() {
- bob = this.physics.add.image(100, 100, 'bob')
- bob.body.collideWorldBounds = true
- cursors = this.input.keyboard.createCursorKeys
- console.log(cursors)
- }
- function update(){
- if(cursors.up.isDown)
- console.log("touche appuyée");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement