Adding static effect sprites from the map
This commit is contained in:
File diff suppressed because one or more lines are too long
BIN
moonlight/gfx/effects/flame.png
Normal file
BIN
moonlight/gfx/effects/flame.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
@@ -287,6 +287,13 @@ var moonlightSettings = {
|
||||
}
|
||||
],
|
||||
'spritesheets': [
|
||||
{
|
||||
'name': 'flame',
|
||||
'path': 'gfx/effects/flame.png',
|
||||
'width': 32,
|
||||
'height': 32,
|
||||
'frames': 96
|
||||
},
|
||||
{
|
||||
'name': 'player',
|
||||
'path': 'gfx/sprites/sprite-player.png',
|
||||
@@ -405,6 +412,11 @@ var moonlightSettings = {
|
||||
'frames': [10, 11, 9],
|
||||
'speed': 12,
|
||||
'loop': true
|
||||
},
|
||||
'campfire_small': {
|
||||
'frames': [6, 7, 8],
|
||||
'speed': 6,
|
||||
'loop': true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -556,6 +568,17 @@ function stringSize(str, font)
|
||||
return [w, h];
|
||||
}
|
||||
|
||||
var EffectSprite = function(game, x, y, key, frame, animation) {
|
||||
this.update_new_values = function() {
|
||||
this.animations.destroy();
|
||||
this.loadTexture(this.sprite_key, 0);
|
||||
addAnimation(this, this.sprite_animation);
|
||||
}
|
||||
|
||||
Phaser.Sprite.call(this, game, x, y, null);
|
||||
game.physics.arcade.enable(this);
|
||||
}
|
||||
|
||||
var AISprite = function(game, x, y, key, frame) {
|
||||
this.enableWordBubble = function() {
|
||||
this.enable_word_bubble = true;
|
||||
@@ -776,6 +799,12 @@ GameState.prototype.create = function()
|
||||
this.aiSprites.forEach(function(spr) {
|
||||
spr.update_new_values();
|
||||
}, this)
|
||||
|
||||
this.effectSprites = game.add.group();
|
||||
this.map.createFromObjects('EffectSprites', 1837, 'player', 0, true, false, this.effectSprites, EffectSprite);
|
||||
this.effectSprites.forEach(function(spr) {
|
||||
spr.update_new_values();
|
||||
}, this)
|
||||
};
|
||||
if ( lp['collides'] == true ) {
|
||||
this.map_collision_layers.push(layer);
|
||||
|
||||
Reference in New Issue
Block a user