Skip to content

Instantly share code, notes, and snippets.

View thaisingle's full-sized avatar

IT Select Lab thaisingle

View GitHub Profile
@thaisingle
thaisingle / main-part4.js
Last active August 29, 2015 14:19
How to create Flappy Bird (Part 4) – Create pipes
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'flappyDiv');
var mainState = {
preload: function() {
game.stage.backgroundColor = '#71c5cf';
game.load.image('bird', 'assets/bird.png');
game.load.image('pipe', 'assets/pipe.png');
},
@thaisingle
thaisingle / flappy.html
Created April 14, 2015 04:23
How to create Flappy Bird (Part 1) - Create game world
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Flappy Bird</title>
<script type="text/javascript" src="js/phaser.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</head>
<body>
<div id="flappyDiv"> </div>
@thaisingle
thaisingle / main-part2.js
Last active August 29, 2015 14:19
How to create Flappy Bird (Part 2) – Add Physics to the Bird
//เราจะสร้าง Game Wolrd ของเราขึ้นมาขนาด 400 x 490
//โดยใช้ระบบ Render แบบ Auto
//และให้ Game แสดงผลใน flappyDiv คือส่วนของ <div> ที่กำหนดไว้ใน flappy.html
//จากนั้นสร้าง Game World ไว้ใน ตัวแปร game
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'flappyDiv');
//ส่วนของ logic เกมส์ที่เราเขียนแล้วเก็บไว้ในตัวแปร mainstate
var mainState = {
preload: function() {
@thaisingle
thaisingle / main-part3.js
Created April 14, 2015 04:45
How to create Flappy Bird (Part 3) – Control the bird
//เราจะสร้าง Game Wolrd ของเราขึ้นมาขนาด 400 x 490
//โดยใช้ระบบ Render แบบ Auto
//และให้ Game แสดงผลใน flappyDiv คือส่วนของ <div> ที่กำหนดไว้ใน flappy.html
//จากนั้นสร้าง Game World ไว้ใน ตัวแปร game
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'flappyDiv');
//ส่วนของ logic เกมส์ที่เราเขียนแล้วเก็บไว้ในตัวแปร mainstate
var mainState = {
preload: function() {
@thaisingle
thaisingle / main-part5.js
Created April 14, 2015 06:01
How to create Flappy Bird (Part 5) – Scoring and Overlapping
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'flappyDiv');
var mainState = {
preload: function() {
game.stage.backgroundColor = '#71c5cf';
game.load.image('bird', 'assets/bird.png');
game.load.image('pipe', 'assets/pipe.png');
},
@thaisingle
thaisingle / main-part6.js
Created April 14, 2015 08:21
How to create Flappy Bird (Part 6) – Flappy
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'flappyDiv');
var mainState = {
preload: function() {
game.stage.backgroundColor = '#71c5cf';
game.load.image('bird', 'assets/bird.png');
game.load.image('pipe', 'assets/pipe.png');
},
@thaisingle
thaisingle / main-part7.js
Created April 14, 2015 09:19
How to create Flappy Bird (Part 7) – Dead animation
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'flappyDiv');
var mainState = {
preload: function() {
game.stage.backgroundColor = '#71c5cf';
game.load.image('bird', 'assets/bird.png');
game.load.image('pipe', 'assets/pipe.png');
},
@thaisingle
thaisingle / main-part8.js
Created April 14, 2015 09:46
How to create Flappy Bird (Part 8) – Jumping sound
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'flappyDiv');
var mainState = {
preload: function() {
game.stage.backgroundColor = '#71c5cf';
game.load.image('bird', 'assets/bird.png');
game.load.image('pipe', 'assets/pipe.png');
game.load.audio('jump', 'assets/flap.wav');
@thaisingle
thaisingle / main-part9.js
Created April 14, 2015 12:03
How to create Flappy Bird (Part 9) – Bird animation
var game = new Phaser.Game(400, 490, Phaser.AUTO, 'flappyDiv');
var mainState = {
preload: function() {
game.stage.backgroundColor = '#71c5cf';
game.load.spritesheet('bird', 'assets/bird.png', 34, 24, 3);
game.load.image('pipe', 'assets/pipe.png');
game.load.audio('jump', 'assets/flap.wav');
},
@thaisingle
thaisingle / main-part10.js
Created April 14, 2015 14:00
How to create Flappy Bird (Part 10) – Image background
var game = new Phaser.Game(288, 505, Phaser.AUTO, 'flappyDiv');
var mainState = {
preload: function() {
game.load.image('background', 'assets/background.png');
game.load.spritesheet('bird', 'assets/bird.png', 34, 24, 3);
game.load.image('pipe', 'assets/pipe.png');
game.load.audio('jump', 'assets/flap.wav');
},