Close #19 : Player lightmeter bases off the ambient light of the world
This commit is contained in:
40
README.md
40
README.md
@@ -1,45 +1,9 @@
|
|||||||
moonlight-skulk
|
moonlight-skulk
|
||||||
===============
|
===============
|
||||||
|
|
||||||
moonlight-skulk is the temporary name of my #indie3jam entry : a JRPG style adventure game with a stealth mechanic
|
moonlight-skulk is the working title for a stealth game wherein you have 8 game hours to steal as much loot as you can before being detected, or before the sun rises.
|
||||||
|
|
||||||
Development notes
|
Development notes
|
||||||
======
|
======
|
||||||
|
|
||||||
This stuff is just for me to keep track, since I'm afraid using GitHub's issue tracker or Wiki would bloat my process, and since I only have 4 days, I can't afford that.
|
Development status is tracked on Waffle : https://waffle.io/akesterson/moonlight-skulk
|
||||||
|
|
||||||
## TODO : Import SAT and use polygonal cones for vision testing
|
|
||||||
|
|
||||||
http://jriecken.github.io/sat-js/ - I had tried using Phaser's bits for this interally, but it was janky, so I put it off and used rectangles instead. Should really get around to using this.
|
|
||||||
|
|
||||||
## TODO : AI should wander around the map
|
|
||||||
|
|
||||||
The AI should, in their default states, wander around the map aimlessly. They should restrict themselves to normal pedestrian traffic lanes, which will likely require the marking of such lanes in TilED.
|
|
||||||
|
|
||||||
## TODO : "Run away" AI reports you to "Chase" AI types
|
|
||||||
|
|
||||||
The "Run Away" AI type should continue running away until it finds a "Chase" AI type to report you to, or until a certain amount of time has passed since the last time they saw you
|
|
||||||
|
|
||||||
## TODO : "Chase" AI should actively "look" for you after it loses you, for a certain amount of time
|
|
||||||
|
|
||||||
See above, once the Chase AI loses you, it should look for you for some time before giving up
|
|
||||||
|
|
||||||
## TODO : Player should be able to "steal" from people
|
|
||||||
|
|
||||||
The player should be able to get within a certain distance of people, press an action button, and "steal" objects from them
|
|
||||||
|
|
||||||
## TODO : Player should be able to pick locks
|
|
||||||
|
|
||||||
It feels more thiefy if the player can pick locks. Maybe incorporate some kind of gesture library to let them jiggle the mouse/wiggle their fingers on the touchscreen to "pick" a lock. This also requires making a distinction between open portals, locked doors, and unlocked doors on the map.
|
|
||||||
|
|
||||||
## TODO : If a player is caught by a Chase AI, then the game is over
|
|
||||||
|
|
||||||
There is no combat in this game; if you are caught, that's it, game over.
|
|
||||||
|
|
||||||
## TODO : Keep score for the player
|
|
||||||
|
|
||||||
The game should keep score based on how much loot the player steals ($$ value?), how many times they have been seen, and how many times they have escaped. The goal of the game is twofold: To play the longest without getting caught, and to have the highest score when you are caught.
|
|
||||||
|
|
||||||
## TODO : AI stops and chats with each other
|
|
||||||
|
|
||||||
A coup de grace would be if, every so often, AI would randomly stop and have short preprogrammed chats with each other.
|
|
||||||
@@ -325,100 +325,6 @@
|
|||||||
"width":0,
|
"width":0,
|
||||||
"x":158,
|
"x":158,
|
||||||
"y":830
|
"y":830
|
||||||
},
|
|
||||||
{
|
|
||||||
"gid":3544,
|
|
||||||
"height":0,
|
|
||||||
"name":"BigTopCustomer2",
|
|
||||||
"properties":
|
|
||||||
{
|
|
||||||
"sprite_group":"townsfolk-male",
|
|
||||||
"sprite_name":"townsfolk-male-3"
|
|
||||||
},
|
|
||||||
"type":"AI",
|
|
||||||
"visible":true,
|
|
||||||
"width":0,
|
|
||||||
"x":613,
|
|
||||||
"y":581
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"gid":3544,
|
|
||||||
"height":0,
|
|
||||||
"name":"BigTopCustomer2",
|
|
||||||
"properties":
|
|
||||||
{
|
|
||||||
"sprite_canmove":"true",
|
|
||||||
"sprite_group":"townsfolk-female",
|
|
||||||
"sprite_name":"townsfolk-female-2"
|
|
||||||
},
|
|
||||||
"type":"AI",
|
|
||||||
"visible":true,
|
|
||||||
"width":0,
|
|
||||||
"x":771,
|
|
||||||
"y":610
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"gid":3544,
|
|
||||||
"height":0,
|
|
||||||
"name":"HousingPerson1",
|
|
||||||
"properties":
|
|
||||||
{
|
|
||||||
"sprite_canmove":"true",
|
|
||||||
"sprite_group":"townsfolk-female",
|
|
||||||
"sprite_name":"townsfolk-female-4"
|
|
||||||
},
|
|
||||||
"type":"AI",
|
|
||||||
"visible":true,
|
|
||||||
"width":0,
|
|
||||||
"x":564,
|
|
||||||
"y":678
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"gid":3544,
|
|
||||||
"height":0,
|
|
||||||
"name":"BigTopCustomer2",
|
|
||||||
"properties":
|
|
||||||
{
|
|
||||||
"sprite_group":"townsfolk-male",
|
|
||||||
"sprite_name":"townsfolk-male-3"
|
|
||||||
},
|
|
||||||
"type":"AI",
|
|
||||||
"visible":true,
|
|
||||||
"width":0,
|
|
||||||
"x":660,
|
|
||||||
"y":664
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"gid":3544,
|
|
||||||
"height":0,
|
|
||||||
"name":"BigTopCustomer2",
|
|
||||||
"properties":
|
|
||||||
{
|
|
||||||
"sprite_canmove":"true",
|
|
||||||
"sprite_group":"townsfolk-female",
|
|
||||||
"sprite_name":"townsfolk-female-2"
|
|
||||||
},
|
|
||||||
"type":"AI",
|
|
||||||
"visible":true,
|
|
||||||
"width":0,
|
|
||||||
"x":718,
|
|
||||||
"y":699
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"gid":3544,
|
|
||||||
"height":0,
|
|
||||||
"name":"HousingPerson1",
|
|
||||||
"properties":
|
|
||||||
{
|
|
||||||
"sprite_canmove":"true",
|
|
||||||
"sprite_group":"townsfolk-female",
|
|
||||||
"sprite_name":"townsfolk-female-4"
|
|
||||||
},
|
|
||||||
"type":"AI",
|
|
||||||
"visible":true,
|
|
||||||
"width":0,
|
|
||||||
"x":623,
|
|
||||||
"y":737
|
|
||||||
}],
|
}],
|
||||||
"opacity":1,
|
"opacity":1,
|
||||||
"type":"objectgroup",
|
"type":"objectgroup",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ STATE_MOVING = 1 << 10;
|
|||||||
|
|
||||||
STATE_RUNNINGTOLIGHT = 1 << 11;
|
STATE_RUNNINGTOLIGHT = 1 << 11;
|
||||||
STATE_RUNNINGTOREPORT = 1 << 12;
|
STATE_RUNNINGTOREPORT = 1 << 12;
|
||||||
|
STATE_LOOKINGFORTARGET = 1 << 13;
|
||||||
|
|
||||||
STATES_AWARENESS = (STATE_UNAWARE | STATE_CONCERNED | STATE_ALERTED | STATE_LOSTHIM);
|
STATES_AWARENESS = (STATE_UNAWARE | STATE_CONCERNED | STATE_ALERTED | STATE_LOSTHIM);
|
||||||
STATES_MOVEMENT = (STATE_MOVING | STATE_RUNNING);
|
STATES_MOVEMENT = (STATE_MOVING | STATE_RUNNING);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ GameState.prototype.create = function()
|
|||||||
|
|
||||||
this.shadowTexture = game.add.bitmapData(game.world.width, game.world.height);
|
this.shadowTexture = game.add.bitmapData(game.world.width, game.world.height);
|
||||||
// drop this lower to make the map darker
|
// drop this lower to make the map darker
|
||||||
this.shadowTextureColor = 'rgb(60, 60, 60)';
|
this.shadowTextureColor = [60, 60, 60];
|
||||||
this.shadowSprite = game.add.image(0, 0, this.shadowTexture);
|
this.shadowSprite = game.add.image(0, 0, this.shadowTexture);
|
||||||
|
|
||||||
this.shadowSprite.blendMode = Phaser.blendModes.MULTIPLY;
|
this.shadowSprite.blendMode = Phaser.blendModes.MULTIPLY;
|
||||||
@@ -125,7 +125,8 @@ GameState.prototype.create = function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GameState.prototype.updateShadowTexture = function() {
|
GameState.prototype.updateShadowTexture = function() {
|
||||||
this.shadowTexture.context.fillStyle = this.shadowTextureColor;
|
var cv = this.shadowTextureColor;
|
||||||
|
this.shadowTexture.context.fillStyle = "rgb(" + cv[0] + "," + cv[1] + "," + cv[2] + ")";
|
||||||
this.shadowTexture.context.fillRect(0, 0, game.world.width, game.world.height);
|
this.shadowTexture.context.fillRect(0, 0, game.world.width, game.world.height);
|
||||||
|
|
||||||
this.staticLights.forEach(function(light) {
|
this.staticLights.forEach(function(light) {
|
||||||
@@ -202,6 +203,7 @@ GameState.prototype.check_input = function()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GameState.prototype.update_player_lightmeter = function() {
|
GameState.prototype.update_player_lightmeter = function() {
|
||||||
|
player.lightmeter = (Number(array_average(this.shadowTextureColor)) / 255.0);
|
||||||
lightValue = 0;
|
lightValue = 0;
|
||||||
this.staticLights.forEach(function(light) {
|
this.staticLights.forEach(function(light) {
|
||||||
var left = player.x;
|
var left = player.x;
|
||||||
@@ -221,11 +223,9 @@ GameState.prototype.update_player_lightmeter = function() {
|
|||||||
lightValue = lv;
|
lightValue = lv;
|
||||||
}
|
}
|
||||||
}, this)
|
}, this)
|
||||||
player.lightmeter = lightValue;
|
player.lightmeter += lightValue;
|
||||||
this.lightbar_crop.width = Math.min(
|
player.lightmeter = Math.min(player.lightmeter, 1.0);
|
||||||
this.lightbar_image.width,
|
this.lightbar_crop.width = ((this.lightbar_image.width) * player.lightmeter);
|
||||||
((this.lightbar_image.width /2) + ((this.lightbar_image.width/2)* lightValue))
|
|
||||||
);
|
|
||||||
this.lightbar.crop(this.lightbar_crop);
|
this.lightbar.crop(this.lightbar_crop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,13 @@ function array_unique(arr) {
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function array_average(arr) {
|
||||||
|
return arr.reduce(function (a,b) {
|
||||||
|
return (a + b);
|
||||||
|
}) / arr.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function stringSize(str, font)
|
function stringSize(str, font)
|
||||||
{
|
{
|
||||||
var width = 0;
|
var width = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user