Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Phaser HTML5 Game Framework @ Otomat Hackaton
Search
Eralp Karaduman
November 19, 2016
Programming
0
160
Phaser HTML5 Game Framework @ Otomat Hackaton
Slides from the lightning talk I gave, at awesome
http://otomat.org
hackaton.
Eralp Karaduman
November 19, 2016
Tweet
Share
Other Decks in Programming
See All in Programming
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
350
俺流レスポンシブコーディング 2025
tak_dcxi
14
8.9k
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
200
SwiftUIで本格音ゲー実装してみた
hypebeans
0
400
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
440
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
140
MAP, Jigsaw, Code Golf 振り返り会 by 関東Kaggler会|Jigsaw 15th Solution
hasibirok0
0
250
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
110
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
190
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
140
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
7
2.2k
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
3
810
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
A Tale of Four Properties
chriscoyier
162
23k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
286
14k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.2k
Mobile First: as difficult as doing things right
swwweet
225
10k
Transcript
PHASER HTML5 GAME FRAMEWORK
ERALP KARADUMAN SUPER DAMAGE GAMES
None
None
None
None
None
None
GLOBAL GAME JAM LUDUM DARE ITCH.IO
None
GAME FRAMEWORK?
RENDERING SCALING PARTICLES
TILEMAPS TIMERS TWEENS
ANIMATION SPRITES INPUT TEXT
PHYSICS AUDIO CANVAS / WEBGL
None
INDEX.HTML <!doctype html> <html> <head> <meta charset="UTF-8" /> <title>try-phaser</title> <link
rel="stylesheet" href="/main.css" media="all"> </head> <body> <div id="content"></div> <script src="/bin/phaser.min.js"></script> <script src="/bin/bundle.js"></script> </body> </html>
MAIN.JS new Phaser.Game(800, 600, Phaser.AUTO, 'content', null);
MAIN.JS var bootState = require("./bootState"); var game = new Phaser.Game(800,
600, Phaser.AUTO, 'content', null); game.state.add('boot', bootState); game.state.start('boot');
MAIN.JS var bootState = require("./bootState"); var loadState = require("./loadState"); var
introState = require("./introState"); var gameState = require("./gameState"); var game = new Phaser.Game(800, 600, Phaser.AUTO, 'content', null); game.state.add('boot', bootState); game.state.add('load', loadState); game.state.add('intro', introState); game.state.add('game', gameState); game.state.start('boot');
BOOTSTATE.JS module.exports = { preload: function() { // load assets
} create: function() { // setup game // initiate player // initiate enemy game.state.start('load'); } update: function() { // handle input & move sprites & check collisions } }
INTROSTATE.JS module.exports = { create: function() { var logo =
this.add.sprite( this.world.centerX, this.world.centerY, 'logo' ); logo.anchor.setTo(0.5, 0.8); var button = this.add.button(this.world.centerX, 500, 'btn', function() { game.state.start('game'); }, this, 1, 0, 0); button.anchor.setTo(0.5, 0.5); } }
None
LOADSTATE.JS module.exports = { preload: function() { this.load.image('logo', 'phaser.png'); this.load.image('man-blue',
'man-blue.png'); this.load.image('man-red', 'man-red.png'); this.load.image('logo', 'phaser.png'); this.load.spritesheet('btn', 'btn-spritesheet.png', 288, 84); }, create: function() { this.state.start('intro'); } }
this.load.spritesheet( 'btn', 'btn-spritesheet.png', 288, 84 );
GAMESTATE.JS var Person = require('./person'); var input = {}; var
player = null function create() { var game = window.game; player = new Person(game, this.world.centerX, this.world.centerY); input.upKey = game.input.keyboard.addKey(Phaser.Keyboard.UP); input.downKey = game.input.keyboard.addKey(Phaser.Keyboard.DOWN); input.leftKey = game.input.keyboard.addKey(Phaser.Keyboard.LEFT); input.rightKey = game.input.keyboard.addKey(Phaser.Keyboard.RIGHT); } function update() { input.up = input.upKey.isDown; input.down = input.downKey.isDown; input.left = input.leftKey.isDown; input.right = input.rightKey.isDown; player.move(input); } module.exports = { create: create, update, update }
GAMESTATE.JS (CREATE) var input = {}; var player = null
function create() { var game = window.game; player = new Person(game, this.world.centerX, this.world.centerY); input.upKey = game.input.keyboard.addKey(Phaser.Keyboard.UP); input.downKey = game.input.keyboard.addKey(Phaser.Keyboard.DOWN); input.leftKey = game.input.keyboard.addKey(Phaser.Keyboard.LEFT); input.rightKey = game.input.keyboard.addKey(Phaser.Keyboard.RIGHT); }
GAMESTATE.JS (UPDATE) function update() { input.up = input.upKey.isDown; input.down =
input.downKey.isDown; input.left = input.leftKey.isDown; input.right = input.rightKey.isDown; player.move(input); }
PERSON.JS var Person = function(game, x, y) { this.moveSpeed =
5; Phaser.Sprite.call(this, game, x, y, 'man-blue'); this.anchor.setTo(0.5, 0.5); game.add.existing(this); } Person.prototype = Object.create(Phaser.Sprite.prototype); Person.prototype.constructor = Person; Person.prototype.update = function() { } Person.prototype.move = function(input) { // ... } module.exports = Person
PERSON.JS (MOVE) Person.prototype.move = function(input) { var pos = {y:
0, x: 0}; if (input.up) { pos.y = -1; } else if (input.down) { pos.y = 1; } if (input.left) { pos.x = -1; } else if (input.right) { pos.x = 1; } this.x += (pos.x * this.moveSpeed); this.y += (pos.y * this.moveSpeed); }
phaser.org ludumdare.com/compo/ itch.io/jams globalgamejam.org @superdamage superdamage.com eralpkaraduman.com @eralpkaraduman