# Popfizz week3 Phaser.io examples and basics ## Examples ### Run and jump type Run and jump (https://codepen.io/lukasz-niedzwiecki/pen/rGOLKq?editors=1010) Santa on the Run (https://codepen.io/natewiley/pen/gbwWMX) flappy bird(https://codepen.io/CyrilSabbagh/pen/zvKgwd) https://codepen.io/jajoosam/pen/rmmMra Run Mummy run https://codepen.io/samme/pen/XNewgO ### Avoid enemy and get score bomb game(https://codepen.io/samme/pen/XYJaQE?editors=1010) ### shoot the target invader(https://codepen.io/njmcode/pen/OyYPZo) https://phaser.io/examples/v2/games/defender ### breakout breakout game(https://codepen.io/K_Cuma/pen/emaJBd) ### clicking event Whack-a-Mole Phaser(https://codepen.io/jaamo/pen/AXzEaq?editors=1010) https://phaser.io/examples/v2/games/tanks ### puzzle puzzle(https://codepen.io/njmcode/pen/RWmxmy) ### matching game https://phaser.io/examples/v2/games/gemmatch #### tutorial https://phaser.io/learn/community-tutorials ## Basics CSS JS ``game= new Phaser.Game( { preload: preloade, create: create, update: update } )`` ## 1. preload : load assets `function preload () { this.load.image('sky', 'assets/sky.png'); this.load.image('ground', 'assets/platform.png'); this.load.image('star', 'assets/star.png'); this.load.image('bomb', 'assets/bomb.png'); this.load.spritesheet('dude', 'assets/dude.png', { frameWidth: 32, frameHeight: 48 } ); }` ## 2. creat : create sprites #### - World building #### - Tile maps `platforms = this.physics.add.staticGroup();` #### - Add player/enemy #### - Learning physics `player.body.setGravityY(300)` `this.physics.add.collider(player, platforms);` #### - keyboard control `cursors = this.input.keyboard.createCursorKeys();` #### - animation #### - (camera movement/following) #### - sound ## 3. update : respond to input and animate - Interaction with created properties e.g. physics(collide, overlap)/animation - Scoring