Skip to content

Commit

Permalink
Tha game works: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
StrykerKKD committed Mar 23, 2014
1 parent 55563a2 commit d2f349f
Show file tree
Hide file tree
Showing 25 changed files with 744 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
SpaceInvaders
=============
This is a remake of the space invader phaser example, which you can find here:
https://examples.phaser.io/

This remake is made with require.js, which breaks up the code into modules.
Modules are in assets/javascript/module

Code is more organized thanks to State and Statemanager class from Phaser.
You can find the states in assets/javascript/state

I used Phaser 2.0.1(no Physics) from the Dev branch.
The dev branch has a lot of bug fixes so it's recommended to use it.

Thanks to require.js, i made an optimized version of my game,
which can be viewed with indexOpt.html. This use the "compiled" code, which can be found in assets/javascript/built

Known issue: In every new play state(after the end state) the game makes new DOM nodes.
The cause: in every cycle i make a new text to show the score.
I tried to destroy the texts but i never succeed.
Binary file added assets/img/bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/enemy-bullet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/explode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/invader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/invader32x32x4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/player.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/starfield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions assets/javascript/built.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* Created by stryker on 2014.03.23..
*/
/*
* Build script
* To use: npm install -g require.js
* r.js -o built.js
* */

({
baseUrl: ".",
name: "main",
out: "built/main-built.js"
})
3 changes: 3 additions & 0 deletions assets/javascript/built/main-built.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions assets/javascript/lib/phaser-no-physics.min.js

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions assets/javascript/lib/require.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions assets/javascript/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Created by stryker on 2014.03.05..
*/
require(['state/Load','state/Start','state/Play','state/End','lib/phaser-no-physics.min'],function(Load,Start,Play,End){

var _game = new Phaser.Game(800, 600, Phaser.AUTO, '');


//Load state
Load.init(_game,'Start'); //args: game object, next state
_game.state.add('Load',Load.getLoadState()); //args: state name, geting the load state

//Start State
Start.init(_game,'Play');
_game.state.add('Start',Start.getStartState());

//Play State
Play.init(_game,'End');
_game.state.add('Play',Play.getPlayState());

//End State
End.init(_game,'Play');
_game.state.add('End',End.getEndState());

//Starting the Load state
_game.state.start('Load');

});
Loading

0 comments on commit d2f349f

Please sign in to comment.