JS と Canvas で作るシューティングゲーム

  • View
    783

  • Download
    1

Embed Size (px)

Text of JS と Canvas で作るシューティングゲーム

JS Canvas

JS Canvas

HN: Twitter: @sairoutineWebProjectJavaScript 1

Unity UnrealEngine

()

JavaScript

https://github.com/takahirox/toho-like-js

DEMO

BrowserifyGulp Canvas APIWeb Audio API

Game.prototype.run = function(){// this.scenes[ this.state ].run();this.scenes[ this.state ].updateDisplay();

// SEthis.runPlaySound();

// this.frame_count++;

// this.before_keyflag = this.keyflag;

// requestAnimationFrame(this.run.bind(this));};

StageScene.prototype.run = function(){// this.character.run();// this.shotmanager.run();// this.enemymanager.run();// this.bulletmanager.run();// this.itemmanager.run();// this.effectmanager.run();// this.bombmanager.run();// this.itemmanager.checkCollisionWithCharacter(this.character);// this.shotmanager.checkCollisionWithEnemies(this.enemymanager);// this.enemymanager.checkCollisionWithCharacter(this.character);// this.bulletmanager.checkCollisionWithCharacter(this.character);};

// Game.prototype.handleKeyDown = function(e){this.keyflag |= this._keyCodeToBitCode(e.keyCode);e.preventDefault( ) ;};// Game.prototype.handleKeyUp = function(e){this.keyflag &= ~this._keyCodeToBitCode(e.keyCode);e.preventDefault( ) ;};

// Game.prototype.isKeyDown = function(flag) {return this.keyflag & flag;};

// Game.prototype.isKeyPush = function(flag) {// 1 truereturn !(this.before_keyflag & flag) && this.keyflag & flag;};

// ObjectBase.prototype.checkCollision = function(obj) {if( this.inCollisionArea(obj.getCollisionLeftX(), obj.getCollisionUpY()) ||this.inCollisionArea(obj.getCollisionLeftX(), obj.getCollisionBottomY()) ||this.inCollisionArea(obj.getCollisionRightX(), obj.getCollisionUpY()) ||this.inCollisionArea(obj.getCollisionRightX(), obj.getCollisionBottomY()) ||this.inCollisionArea(obj.x, obj.y) ) {return true ;}

return false ;};

var __enemyBulletsParams = [ [ { 'v': { 'r': 5, 'theta': 165, 'w': 0, 'ra': 0.1, 'wa': 0, 'raa': -0.01, 'rrange': { 'min': 2 } }, }, { 'v': { 'r': 5, 'theta': 135, 'w': 0, 'ra': 0.1, 'wa': 0, 'raa': -0.01, 'rrange': { 'min': 2 } }, }, { 'v': { 'r': 5, 'theta': 105, 'w': 0, 'ra': 0.1, 'wa': 0, 'raa': -0.01, 'rrange': { 'min': 2 } }, }, { 'v': { 'r': 5, 'theta': 75, 'w': 0, 'ra': 0.1, 'wa': 0, 'raa': -0.01, 'rrange': { 'min': 2 } }, }, { 'v': { 'r': 5, 'theta': 45, 'w': 0, 'ra': 0.1, 'wa': 0, 'raa': -0.01, 'rrange': { 'min': 2 } }, }, { 'v': { 'r': 5, 'theta': 15, 'w': 0, 'ra': 0.1, 'wa': 0, 'raa': -0.01, 'rrange': { 'min': 2 } }, }, ]];

(x, y)

1/60PC Chrome V8

WebGL