Making AI able to 'see' the player
This commit is contained in:
@@ -164,6 +164,7 @@
|
|||||||
"name":"FountainGuard",
|
"name":"FountainGuard",
|
||||||
"properties":
|
"properties":
|
||||||
{
|
{
|
||||||
|
"can_move":"false",
|
||||||
"sprite_group":"townsfolk-female",
|
"sprite_group":"townsfolk-female",
|
||||||
"sprite_name":"townsfolk-female-3"
|
"sprite_name":"townsfolk-female-3"
|
||||||
},
|
},
|
||||||
@@ -176,10 +177,10 @@
|
|||||||
{
|
{
|
||||||
"gid":3544,
|
"gid":3544,
|
||||||
"height":0,
|
"height":0,
|
||||||
"name":"",
|
"name":"FountainPerson",
|
||||||
"properties":
|
"properties":
|
||||||
{
|
{
|
||||||
|
"can_move":"false"
|
||||||
},
|
},
|
||||||
"type":"",
|
"type":"",
|
||||||
"visible":true,
|
"visible":true,
|
||||||
@@ -229,7 +230,7 @@
|
|||||||
"y":40
|
"y":40
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"gid":11,
|
"gid":1837,
|
||||||
"height":0,
|
"height":0,
|
||||||
"name":"campfiresound",
|
"name":"campfiresound",
|
||||||
"properties":
|
"properties":
|
||||||
@@ -555,4 +556,4 @@
|
|||||||
"tilewidth":32,
|
"tilewidth":32,
|
||||||
"version":1,
|
"version":1,
|
||||||
"width":100
|
"width":100
|
||||||
}
|
}
|
||||||
@@ -714,6 +714,8 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( this.can_move == false)
|
||||||
|
return;
|
||||||
if ( game.rnd.integerInRange(0, 100) < 95 )
|
if ( game.rnd.integerInRange(0, 100) < 95 )
|
||||||
return;
|
return;
|
||||||
if ( game.rnd.integerInRange(0, 100) > 90 ) {
|
if ( game.rnd.integerInRange(0, 100) > 90 ) {
|
||||||
@@ -747,6 +749,10 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
this.animations.destroy();
|
this.animations.destroy();
|
||||||
this.clearWordBubble();
|
this.clearWordBubble();
|
||||||
this.state = STATE_UNAWARE;
|
this.state = STATE_UNAWARE;
|
||||||
|
this.can_move = Boolean(this.can_move);
|
||||||
|
this.collide_with_player = Boolean(this.collide_with_player);
|
||||||
|
this.collide_with_map = Boolean(this.collide_with_map);
|
||||||
|
this.carries_light = Boolean(this.carries_light);
|
||||||
|
|
||||||
this.loadTexture(this.sprite_name, 0);
|
this.loadTexture(this.sprite_name, 0);
|
||||||
addAnimation(this, 'bipedwalkleft');
|
addAnimation(this, 'bipedwalkleft');
|
||||||
@@ -776,6 +782,7 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
|
|
||||||
Phaser.Sprite.call(this, game, x, y, null);
|
Phaser.Sprite.call(this, game, x, y, null);
|
||||||
game.physics.arcade.enable(this);
|
game.physics.arcade.enable(this);
|
||||||
|
this.can_move = false;
|
||||||
this.collide_with_player = true;
|
this.collide_with_player = true;
|
||||||
this.collide_with_map = true;
|
this.collide_with_map = true;
|
||||||
this.carries_light = false;
|
this.carries_light = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user