Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. const config = {
  2. width: 500,
  3. height: 300,
  4. type: Phaser.AUTO,
  5. physics: {
  6. default: 'arcade',
  7. arcade: {
  8. gravity: {y: 450}
  9. }
  10. },
  11. scene: {
  12. preload: preload,
  13. create: create,
  14. update: update
  15. }
  16. }
  17.  
  18.  
  19. var game = new Phaser.Game (config)
  20. let bob
  21. let cursors
  22.  
  23. function preload() {
  24. this.load.image('bob', 'oui/bob.png')
  25.  
  26. }
  27.  
  28. function create() {
  29. bob = this.physics.add.image(100, 100, 'bob')
  30. bob.body.collideWorldBounds = true
  31.  
  32. cursors = this.input.keyboard.createCursorKeys
  33. console.log(cursors)
  34.  
  35. }
  36.  
  37. function update(){
  38. if(cursors.up.isDown)
  39. console.log("touche appuyée");
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement