For #7 : Townsfolk and guardsmen spawn with 'treasure'. AI with treasure will occasionally 'glint' playing an effect to show the player they have treasure.
This commit is contained in:
BIN
moonlight/gfx/effects/glint.png
Normal file
BIN
moonlight/gfx/effects/glint.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1005 B |
@@ -272,6 +272,7 @@
|
|||||||
"sprite_canmove":"false",
|
"sprite_canmove":"false",
|
||||||
"sprite_facing":"down",
|
"sprite_facing":"down",
|
||||||
"sprite_group":"townsfolk-guard",
|
"sprite_group":"townsfolk-guard",
|
||||||
|
"sprite_has_treasure":"true",
|
||||||
"sprite_name":"townsfolk-guard-2"
|
"sprite_name":"townsfolk-guard-2"
|
||||||
},
|
},
|
||||||
"type":"AI",
|
"type":"AI",
|
||||||
|
|||||||
BIN
moonlight/gfx/sprites/treasure.png
Normal file
BIN
moonlight/gfx/sprites/treasure.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 157 KiB |
@@ -73,6 +73,29 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
this.awareness_timer.start()
|
this.awareness_timer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.runGlintEffect = function() {
|
||||||
|
if ( this.sprite_has_treasure == true ) {
|
||||||
|
this.glint_effect = game.state.states.game.add.sprite(
|
||||||
|
this.x + 16,
|
||||||
|
this.y + 24,
|
||||||
|
'glint',
|
||||||
|
0,
|
||||||
|
game.state.states.game.aiSpriteEffects
|
||||||
|
);
|
||||||
|
addAnimation(this.glint_effect, 'glint');
|
||||||
|
this.glint_effect.anchor.setTo(0.5, 0.5);
|
||||||
|
this.glint_effect.play('glint', null, false, true);
|
||||||
|
this.glint_timer = game.time.create(false);
|
||||||
|
this.glint_timer.add(game.rnd.integerInRange(5000, 15000),
|
||||||
|
this.runGlintEffect,
|
||||||
|
this);
|
||||||
|
tween = game.add.tween(this.glint_effect);
|
||||||
|
tween.to({angle: 180}, 1000, null);
|
||||||
|
tween.start();
|
||||||
|
this.glint_timer.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setAwarenessEffect = function(state) {
|
this.setAwarenessEffect = function(state) {
|
||||||
var animkey = "";
|
var animkey = "";
|
||||||
|
|
||||||
@@ -550,7 +573,13 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
this.awareness_effect.y = this.y - 16;
|
this.awareness_effect.y = this.y - 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( isSet(this.glint_effect) ) {
|
||||||
|
if ( this.glint_effect.alive == true ) {
|
||||||
|
this.glint_effect.x = this.x + 16;
|
||||||
|
this.glint_effect.y = this.y + 24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( isSet(this.bubble_text) ) {
|
if ( isSet(this.bubble_text) ) {
|
||||||
if ( this.clear_bubble == true ) {
|
if ( this.clear_bubble == true ) {
|
||||||
this.bubble_text.destroy();
|
this.bubble_text.destroy();
|
||||||
@@ -590,6 +619,10 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
this.collide_with_player = parseBoolean(this.collide_with_player);
|
this.collide_with_player = parseBoolean(this.collide_with_player);
|
||||||
this.collide_with_map = parseBoolean(this.collide_with_map);
|
this.collide_with_map = parseBoolean(this.collide_with_map);
|
||||||
this.carries_light = parseBoolean(this.carries_light);
|
this.carries_light = parseBoolean(this.carries_light);
|
||||||
|
this.sprite_has_treasure = parseBoolean(this.sprite_has_treasure);
|
||||||
|
if ( this.sprite_has_treasure ) {
|
||||||
|
this.treasure = getRandomTreasure();
|
||||||
|
}
|
||||||
|
|
||||||
this.path_maximum_steps = parseInt(this.path_maximum_steps);
|
this.path_maximum_steps = parseInt(this.path_maximum_steps);
|
||||||
this.loadTexture(this.sprite_name, 0);
|
this.loadTexture(this.sprite_name, 0);
|
||||||
@@ -604,6 +637,7 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
setMovingState(this, faceStateFromString(this.sprite_facing));
|
setMovingState(this, faceStateFromString(this.sprite_facing));
|
||||||
setSpriteMovement(this);
|
setSpriteMovement(this);
|
||||||
this.ready_to_update = true;
|
this.ready_to_update = true;
|
||||||
|
this.runGlintEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
var spritenames_by_type = [
|
var spritenames_by_type = [
|
||||||
@@ -637,6 +671,8 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
this.sprite_can_see_lightmeter = 0.3;
|
this.sprite_can_see_lightmeter = 0.3;
|
||||||
this.awareness_effect = null;
|
this.awareness_effect = null;
|
||||||
this.awareness_timer = null;
|
this.awareness_timer = null;
|
||||||
|
this.glint_effect = null;
|
||||||
|
this.glint_timer = null;
|
||||||
this.lastSawPlayerAt = null;
|
this.lastSawPlayerAt = null;
|
||||||
this.seen_directions = [];
|
this.seen_directions = [];
|
||||||
this.sprite_awareness_duration = 30000;
|
this.sprite_awareness_duration = 30000;
|
||||||
@@ -648,6 +684,7 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
this.timer = null;
|
this.timer = null;
|
||||||
this.rotation_timer = null;
|
this.rotation_timer = null;
|
||||||
this.origin = new Phaser.Point(x, y);
|
this.origin = new Phaser.Point(x, y);
|
||||||
|
this.sprite_has_treasure = [true, false][game.rnd.integerInRange(0, 1)];
|
||||||
this.bubble_immediate = false;
|
this.bubble_immediate = false;
|
||||||
this.bubble_text = null;
|
this.bubble_text = null;
|
||||||
this.enable_word_bubble = false;
|
this.enable_word_bubble = false;
|
||||||
|
|||||||
@@ -56,3 +56,5 @@ SCORE_PERSECOND = 1;
|
|||||||
SCORE_LOSTHIM = 0;
|
SCORE_LOSTHIM = 0;
|
||||||
SCORE_ALERTED = -50;
|
SCORE_ALERTED = -50;
|
||||||
SCORE_CONCERNED = 0;
|
SCORE_CONCERNED = 0;
|
||||||
|
|
||||||
|
MAX_TREASURES = 384;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ GameState.prototype.create = function()
|
|||||||
this.aiSprites.forEach(function(spr) {
|
this.aiSprites.forEach(function(spr) {
|
||||||
spr.update_new_values();
|
spr.update_new_values();
|
||||||
}, this)
|
}, this)
|
||||||
|
this.aiSpriteEffects = game.add.group();
|
||||||
player = this.add.sprite((19 * 32), (21 * 32), 'player');
|
player = this.add.sprite((19 * 32), (21 * 32), 'player');
|
||||||
player.score = 0;
|
player.score = 0;
|
||||||
player.lightmeter = 0;
|
player.lightmeter = 0;
|
||||||
|
|||||||
@@ -168,6 +168,20 @@ var moonlightSettings = {
|
|||||||
'height': 32,
|
'height': 32,
|
||||||
'frames': 96
|
'frames': 96
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'name': 'glint',
|
||||||
|
'path': 'gfx/effects/glint.png',
|
||||||
|
'width': 16,
|
||||||
|
'height': 16,
|
||||||
|
'frames': 12
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'treasure',
|
||||||
|
'path': 'gfx/sprites/treasure.png',
|
||||||
|
'width': 24,
|
||||||
|
'height': 24,
|
||||||
|
'frames': 368
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'name': 'balloon',
|
'name': 'balloon',
|
||||||
'path': 'gfx/effects/Balloon.png',
|
'path': 'gfx/effects/Balloon.png',
|
||||||
@@ -254,6 +268,11 @@ var moonlightSettings = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
'animations': {
|
'animations': {
|
||||||
|
'glint': {
|
||||||
|
'frames': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
|
||||||
|
'speed': 12,
|
||||||
|
'loop': false
|
||||||
|
},
|
||||||
'alerted': {
|
'alerted': {
|
||||||
'frames': [0, 1, 2, 3, 4, 5, 6, 7],
|
'frames': [0, 1, 2, 3, 4, 5, 6, 7],
|
||||||
'speed': 4,
|
'speed': 4,
|
||||||
@@ -331,3 +350,206 @@ var moonlightSettings = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var moonlightTreasures = {
|
||||||
|
"silver ring with garnet": {
|
||||||
|
"x": 6,
|
||||||
|
"y": 1,
|
||||||
|
"value": 50
|
||||||
|
},
|
||||||
|
"gold hairpin": {
|
||||||
|
"x": 7,
|
||||||
|
"y": 1,
|
||||||
|
"value": 50
|
||||||
|
},
|
||||||
|
"gold ring with emerald": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 2,
|
||||||
|
"value": 75
|
||||||
|
},
|
||||||
|
"silver bangles": {
|
||||||
|
"x": 1,
|
||||||
|
"y": 2,
|
||||||
|
"value": 50
|
||||||
|
},
|
||||||
|
"gold bracelets": {
|
||||||
|
"x": 2,
|
||||||
|
"y": 2,
|
||||||
|
"value": 75
|
||||||
|
},
|
||||||
|
"gold brooch with sapphire": {
|
||||||
|
"x": 3,
|
||||||
|
"y": 2,
|
||||||
|
"value": 75
|
||||||
|
},
|
||||||
|
"gold necklace with sapphire": {
|
||||||
|
"x": 4,
|
||||||
|
"y": 2,
|
||||||
|
"value": 75
|
||||||
|
},
|
||||||
|
"tonic": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 3,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"antidote": {
|
||||||
|
"x": 1,
|
||||||
|
"y": 3,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"cure-all": {
|
||||||
|
"x": 2,
|
||||||
|
"y": 3,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"poison": {
|
||||||
|
"x": 3,
|
||||||
|
"y": 3,
|
||||||
|
"value": 150
|
||||||
|
},
|
||||||
|
"perfume": {
|
||||||
|
"x": 4,
|
||||||
|
"y": 3,
|
||||||
|
"value": 125
|
||||||
|
},
|
||||||
|
"spices": {
|
||||||
|
"x": 6,
|
||||||
|
"y": 3,
|
||||||
|
"value": 125
|
||||||
|
},
|
||||||
|
"Fresh Spinach": {
|
||||||
|
"x": 8,
|
||||||
|
"y": 3,
|
||||||
|
"value": 5
|
||||||
|
},
|
||||||
|
"Fresh Herbs": {
|
||||||
|
"x": 9,
|
||||||
|
"y": 3,
|
||||||
|
"value": 5
|
||||||
|
},
|
||||||
|
"Flowers": {
|
||||||
|
"x": 12,
|
||||||
|
"y": 3,
|
||||||
|
"value": 5
|
||||||
|
},
|
||||||
|
"Dirty Turnips": {
|
||||||
|
"x": 14,
|
||||||
|
"y": 3,
|
||||||
|
"value": 5
|
||||||
|
},
|
||||||
|
"Whiskey": {
|
||||||
|
"x": 12,
|
||||||
|
"y": 4,
|
||||||
|
"value": 10
|
||||||
|
},
|
||||||
|
"Map": {
|
||||||
|
"x": 7,
|
||||||
|
"y": 5,
|
||||||
|
"value": 15
|
||||||
|
},
|
||||||
|
"Official Documents": {
|
||||||
|
"x": 14,
|
||||||
|
"y": 5,
|
||||||
|
"value": 50
|
||||||
|
},
|
||||||
|
"Book": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 5,
|
||||||
|
"value": 25
|
||||||
|
},
|
||||||
|
"Gift": {
|
||||||
|
"x": 3,
|
||||||
|
"y": 7,
|
||||||
|
"value": 50
|
||||||
|
},
|
||||||
|
"Bag of Money": {
|
||||||
|
"x": 6,
|
||||||
|
"y": 7,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"Purse": {
|
||||||
|
"x": 7,
|
||||||
|
"y": 7,
|
||||||
|
"value": 50
|
||||||
|
},
|
||||||
|
"Picnic Basket": {
|
||||||
|
"x": 9,
|
||||||
|
"y": 7,
|
||||||
|
"value": 25
|
||||||
|
},
|
||||||
|
"Jewelry Box": {
|
||||||
|
"x": 14,
|
||||||
|
"y": 7,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"Music Box": {
|
||||||
|
"x": 15,
|
||||||
|
"y": 6,
|
||||||
|
"value": 300
|
||||||
|
},
|
||||||
|
"Hourglass": {
|
||||||
|
"x": 8,
|
||||||
|
"y": 8,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"Holy Symbol": {
|
||||||
|
"x": 9,
|
||||||
|
"y": 8,
|
||||||
|
"value": 200
|
||||||
|
},
|
||||||
|
"Large Mirror": {
|
||||||
|
"x": 10,
|
||||||
|
"y": 8,
|
||||||
|
"value": 200
|
||||||
|
},
|
||||||
|
"Small Mirror": {
|
||||||
|
"x": 11,
|
||||||
|
"y": 8,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"Cat's Eye": {
|
||||||
|
"x": 4,
|
||||||
|
"y": 12,
|
||||||
|
"value": 200
|
||||||
|
},
|
||||||
|
"Pink Spinel": {
|
||||||
|
"x": 5,
|
||||||
|
"y": 12,
|
||||||
|
"value": 200
|
||||||
|
},
|
||||||
|
"Quartz": {
|
||||||
|
"x": 6,
|
||||||
|
"y": 12,
|
||||||
|
"value": 100
|
||||||
|
},
|
||||||
|
"Diamond": {
|
||||||
|
"x": 9,
|
||||||
|
"y": 12,
|
||||||
|
"value": 400
|
||||||
|
},
|
||||||
|
"Emerald": {
|
||||||
|
"x": 11,
|
||||||
|
"y": 12,
|
||||||
|
"value": 300
|
||||||
|
},
|
||||||
|
"Ruby": {
|
||||||
|
"x": 7,
|
||||||
|
"y": 13,
|
||||||
|
"value": 250
|
||||||
|
},
|
||||||
|
"Pearl": {
|
||||||
|
"x": 8,
|
||||||
|
"y": 13,
|
||||||
|
"value": 400
|
||||||
|
},
|
||||||
|
"Gold Bars": {
|
||||||
|
"x": 9,
|
||||||
|
"y": 13,
|
||||||
|
"value": 500
|
||||||
|
},
|
||||||
|
"Gold Coin": {
|
||||||
|
"x": 10,
|
||||||
|
"y": 13,
|
||||||
|
"value": 5
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -339,3 +339,10 @@ function awardPlayerScoreByState(state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRandomTreasure()
|
||||||
|
{
|
||||||
|
var treasures = Object.keys(moonlightTreasures);
|
||||||
|
var treasure = treasures[game.rnd.integerInRange(0, treasures.length)];
|
||||||
|
return treasure;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user