Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bq.Beam -> bq.beam.Beamに変更。しかるべきディレクトリにポイッチョする #52

Merged
merged 2 commits into from
Jan 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/cocos2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
'js/src/entity/animation.js',
'js/src/entity/player.js',
'js/src/entity/enemy.js',
'js/src/entity/beam.js',
'js/src/beam/beam.js',
'js/src/ping.js',
'js/src/camera.js',

Expand Down
21 changes: 11 additions & 10 deletions public/js/src/entity/beam.js → public/js/src/beam/beam.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* @fileoverview ビームの基底クラス
*/
bq.beam = {};

/**
* @constructor
* @extends {cc.Node}
*/
bq.Beam = cc.Node.extend({
bq.beam.Beam = cc.Node.extend({
id: bq.Types.Beams.NORMAL, // ビームID
tag: '', // ビーム識別用タグ
destination_:cc.p(0,0), // {cc.p} 目標
Expand Down Expand Up @@ -107,16 +108,16 @@ bq.Beam = cc.Node.extend({
},

dispose: function() {
$(this).triggerHandler(bq.Beam.EventType.REMOVE);
$(this).triggerHandler(bq.beam.Beam.EventType.REMOVE);
this.removeFromParent();
}
});

/**
* プリセットからビームを取り出す
* @return {bq.Beam} プリセットされたビームを返す、キャッシュされたビームが尽きていた場合は不定(今のところnullを返す)
* @return {bq.beam.Beam} プリセットされたビームを返す、キャッシュされたビームが尽きていた場合は不定(今のところnullを返す)
*/
bq.Beam.pop = function() {
bq.beam.Beam.pop = function() {
"use strict";
if (bq.beams.length <= 0 ) {
return null;
Expand All @@ -136,11 +137,11 @@ bq.Beam.pop = function() {
* @param {bq.Types.Beams} beamType
* @param {string} shooterId
* @param {string} tag
* @return {bq.Beam}
* @return {bq.beam.Beam}
*/
bq.Beam.create = function(beamType, shooterId, tag) {
bq.beam.Beam.create = function(beamType, shooterId, tag) {
"use strict";
var beam = new bq.Beam(beamType, shooterId, tag);
var beam = new bq.beam.Beam(beamType, shooterId, tag);

// パーティクルをセット
var particle = null;
Expand Down Expand Up @@ -169,18 +170,18 @@ bq.Beam.create = function(beamType, shooterId, tag) {
* @param {number} id
* @param {cc.Layer} layer
*/
bq.Beam.setup = function(id, layer, shooterId) {
bq.beam.Beam.setup = function(id, layer, shooterId) {
"use strict";

var maxBeamCount = 5;
_.times(maxBeamCount, function(i) {
var beam = bq.Beam.create(id, shooterId);
var beam = bq.beam.Beam.create(id, shooterId);
bq.beams[i] = beam;
layer.addChild(beam, 10);
});

};

bq.Beam.EventType = {
bq.beam.Beam.EventType = {
REMOVE: 'remove'
};
4 changes: 2 additions & 2 deletions public/js/src/entityManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ bq.EntityManager = cc.Class.extend({
*/
beamShoot: function(beamPos) {
// TODO: ほんとはここじゃなくてentityに定義されたshoot()関数的なやつを呼ぶのがいい。
var beam = bq.Beam.create(beamPos.beamId, beamPos.shooterId, beamPos.tag);
var beam = bq.beam.Beam.create(beamPos.beamId, beamPos.shooterId, beamPos.tag);
bq.baseLayer.addChild(beam, 10);
cc.AudioEngine.getInstance().playEffect(s_SeBeamA);
beam.initDestination(beamPos.src, beamPos.dest);
$(beam).on(bq.Beam.EventType.REMOVE, $.proxy(this.handleBeamRemove_, this));
$(beam).on(bq.beam.Beam.EventType.REMOVE, $.proxy(this.handleBeamRemove_, this));
this.beams_[beamPos.tag] = beam;
},

Expand Down
5 changes: 5 additions & 0 deletions public/js/src/scene/beamQuest.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ bq.scene.BeamQuestWorld = cc.Layer.extend({
baseLayer.setPosition(cc.p(0,0));
this.addChild(baseLayer, 1, bq.config.tags.BASE_LAYER);

bq.beam.Beam.setup(bq.player.beamId[0], baseLayer, bq.player.name);

bq.player.setPosition(cc.p(size.width / 2, size.height / 2));
baseLayer.addChild(bq.player, 100, bq.config.tags.PLAYER);

this.camera = new bq.Camera(baseLayer);
this.camera.lookAt(bq.player);
bq.camera = this.camera;
Expand Down