Panic works. Variable brightness. Brighter lights. Updated tileset.
This commit is contained in:
@@ -23,9 +23,9 @@ namespace DepthsBelow.Component
|
|||||||
public Flashlight(Entity parent)
|
public Flashlight(Entity parent)
|
||||||
: base(parent)
|
: base(parent)
|
||||||
{
|
{
|
||||||
Texture = GameServices.GetService<ContentManager>().Load<Texture2D>("images/lights/spot");
|
Texture = GameServices.GetService<ContentManager>().Load<Texture2D>("images/lights/spot_wide");
|
||||||
Color = Color.White;
|
Color = Color.White;
|
||||||
Origin = new Vector2(50, 60);
|
Origin = new Vector2(50, Texture.Height / 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ namespace DepthsBelow.Component
|
|||||||
if (HP == 0)
|
if (HP == 0)
|
||||||
HP = value;
|
HP = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int MaxPanic = 100;
|
||||||
|
|
||||||
protected int hp = 0;
|
protected int hp = 0;
|
||||||
protected int defence = 0;
|
protected int defence = 0;
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
public static Map Map;
|
public static Map Map;
|
||||||
|
|
||||||
public SmallEnemy TestMonster;
|
public SmallEnemy TestMonster;
|
||||||
|
|
||||||
|
public int Brightness = 30;
|
||||||
|
|
||||||
public Core()
|
public Core()
|
||||||
{
|
{
|
||||||
@@ -167,7 +169,7 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
// Draw to the lighting render target
|
// Draw to the lighting render target
|
||||||
GraphicsDevice.SetRenderTarget(lightRenderTarget);
|
GraphicsDevice.SetRenderTarget(lightRenderTarget);
|
||||||
GraphicsDevice.Clear(new Color(10, 10, 10));
|
GraphicsDevice.Clear(new Color(Brightness, Brightness, Brightness));
|
||||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointClamp, null, null, null,
|
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointClamp, null, null, null,
|
||||||
Camera.Transform);
|
Camera.Transform);
|
||||||
|
|
||||||
@@ -203,7 +205,7 @@ namespace DepthsBelow
|
|||||||
{
|
{
|
||||||
var lightData = new Color[1];
|
var lightData = new Color[1];
|
||||||
lightRenderTarget.GetData<Color>(0, sourceRect, lightData, 0, 1);
|
lightRenderTarget.GetData<Color>(0, sourceRect, lightData, 0, 1);
|
||||||
if (lightData[0] != new Color(10, 10, 10))
|
if (lightData[0] != new Color(Brightness, Brightness, Brightness))
|
||||||
spriteRenderer.Draw(spriteBatch);
|
spriteRenderer.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,20 @@ namespace DepthsBelow
|
|||||||
{
|
{
|
||||||
public List<Entity> Entities;
|
public List<Entity> Entities;
|
||||||
public float Panic;
|
public float Panic;
|
||||||
|
public float MaxPanic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
float maxPanic = 0;
|
||||||
|
foreach (var entity in Entities)
|
||||||
|
{
|
||||||
|
var stats = entity.GetComponent<Component.Stat>();
|
||||||
|
if (stats != null)
|
||||||
|
maxPanic += stats.MaxPanic;
|
||||||
|
}
|
||||||
|
return maxPanic;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Entity> entities;
|
private List<Entity> entities;
|
||||||
@@ -37,21 +51,27 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
foreach (var newGroup in newGroups)
|
foreach (var newGroup in newGroups)
|
||||||
{
|
{
|
||||||
foreach (var entity in newGroup.Entities)
|
for (int index = 0; index < newGroup.Entities.Count; index++)
|
||||||
{
|
{
|
||||||
|
var entity = newGroup.Entities[index];
|
||||||
|
|
||||||
Group oldGroup = null;
|
Group oldGroup = null;
|
||||||
// Find the group the entity belonged to before
|
// Find the group the entity belonged to before
|
||||||
foreach (var group in Groups)
|
foreach (var group in Groups)
|
||||||
{
|
{
|
||||||
if (group.Entities.Contains(entity))
|
if (@group.Entities.Contains(entity))
|
||||||
{
|
{
|
||||||
oldGroup = group;
|
oldGroup = @group;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldGroup != null)
|
if (oldGroup != null)
|
||||||
newGroup.Panic += oldGroup.Panic / oldGroup.Entities.Count;
|
{
|
||||||
|
newGroup.Panic += (oldGroup.Panic / oldGroup.MaxPanic) * (float)entity.GetComponent<Component.Stat>().MaxPanic;
|
||||||
|
oldGroup.Panic -= (oldGroup.Panic / oldGroup.MaxPanic) * (float)entity.GetComponent<Component.Stat>().MaxPanic;
|
||||||
|
oldGroup.Entities.Remove(entity);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
newGroup.Panic = 10;
|
newGroup.Panic = 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,11 @@ namespace DepthsBelow
|
|||||||
public static void Draw(SpriteBatch spriteBatch)
|
public static void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
foreach (var frame in Frames.OrderBy(f => f, new FrameSort()))
|
foreach (var frame in Frames.OrderBy(f => f, new FrameSort()))
|
||||||
|
{
|
||||||
frame.Draw(spriteBatch);
|
frame.Draw(spriteBatch);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
|
||||||
namespace DepthsBelow
|
namespace DepthsBelow
|
||||||
{
|
{
|
||||||
@@ -140,9 +141,12 @@ namespace DepthsBelow
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var leftEdge = new Frame(UIParent);
|
var button = new GUI.Button(UIParent);
|
||||||
leftEdge.Width = 20;
|
button.SetTexture("images/Enter");
|
||||||
leftEdge.Height = GameServices.GetService<GraphicsDevice>().Viewport.Height;
|
button.X = 100;
|
||||||
|
button.Y = 100;
|
||||||
|
button.Width = 55;
|
||||||
|
button.Height = 40;
|
||||||
|
|
||||||
// Test GUI frames
|
// Test GUI frames
|
||||||
/*var frame = new GUI.Frame()
|
/*var frame = new GUI.Frame()
|
||||||
@@ -228,6 +232,13 @@ namespace DepthsBelow
|
|||||||
frame.Width = 164;
|
frame.Width = 164;
|
||||||
frame.Height = 19;
|
frame.Height = 19;
|
||||||
|
|
||||||
|
frame.OnClick += delegate(Frame frame1, GUIManager.MouseEventArgs args)
|
||||||
|
{
|
||||||
|
DynamicGroupManager.Group group = (DynamicGroupManager.Group)frame1["group"];
|
||||||
|
if (group != null)
|
||||||
|
group.Panic += 5;
|
||||||
|
};
|
||||||
|
|
||||||
var panicBarBg = new GUI.Frame(frame);
|
var panicBarBg = new GUI.Frame(frame);
|
||||||
panicBarBg.SetTexture("images/GUI/health_background");
|
panicBarBg.SetTexture("images/GUI/health_background");
|
||||||
panicBarBg.Width = 136;
|
panicBarBg.Width = 136;
|
||||||
@@ -245,6 +256,13 @@ namespace DepthsBelow
|
|||||||
panicBar.Y = 1;
|
panicBar.Y = 1;
|
||||||
frame["panicBar"] = panicBar;
|
frame["panicBar"] = panicBar;
|
||||||
|
|
||||||
|
var text = new GUI.Text(frame);
|
||||||
|
text.SetFont("fonts/UnitName");
|
||||||
|
text.Value = "0%";
|
||||||
|
text.X = 4;
|
||||||
|
text.Y = 1;
|
||||||
|
frame["text"] = text;
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,9 +392,12 @@ namespace DepthsBelow
|
|||||||
var group = groups[index];
|
var group = groups[index];
|
||||||
|
|
||||||
var pFrame = PanicFrames[index];
|
var pFrame = PanicFrames[index];
|
||||||
|
pFrame["group"] = group;
|
||||||
var pFrameBarBg = (GUI.Frame)pFrame["panicBarBg"];
|
var pFrameBarBg = (GUI.Frame)pFrame["panicBarBg"];
|
||||||
var pFrameBar = (GUI.Frame)pFrame["panicBar"];
|
var pFrameBar = (GUI.Frame)pFrame["panicBar"];
|
||||||
pFrameBar.Width = (int)(pFrameBarBg.Width * (group.Panic / 100f));
|
var pFrameText = (GUI.Text)pFrame["text"];
|
||||||
|
pFrameBar.Width = (int)(pFrameBarBg.Width * (group.Panic / group.MaxPanic));
|
||||||
|
pFrameText.Value = group.Panic.ToString() + " (" + (group.Panic / group.MaxPanic * 100f).ToString() + "%)";
|
||||||
|
|
||||||
pFrame.Visible = true;
|
pFrame.Visible = true;
|
||||||
if (lastFrame != null)
|
if (lastFrame != null)
|
||||||
|
|||||||
@@ -105,11 +105,11 @@ namespace DepthsBelow
|
|||||||
{
|
{
|
||||||
KeyboardState ks = Keyboard.GetState();
|
KeyboardState ks = Keyboard.GetState();
|
||||||
|
|
||||||
// Lua reload scripts
|
// Brightness
|
||||||
if (ks.IsKeyUp(Keys.R) && lastKeyboardState.IsKeyDown(Keys.R))
|
if (ks.IsKeyUp(Keys.Up) && lastKeyboardState.IsKeyDown(Keys.Up))
|
||||||
{
|
core.Brightness = (int)MathHelper.Clamp(core.Brightness + 5, 0, 254);
|
||||||
core.Lua.Reload();
|
if (ks.IsKeyUp(Keys.Down) && lastKeyboardState.IsKeyDown(Keys.Down))
|
||||||
}
|
core.Brightness = (int)MathHelper.Clamp(core.Brightness - 5, 0, 254);
|
||||||
|
|
||||||
// Debug test: grouping
|
// Debug test: grouping
|
||||||
if (ks.IsKeyUp(Keys.K) && lastKeyboardState.IsKeyDown(Keys.K))
|
if (ks.IsKeyUp(Keys.K) && lastKeyboardState.IsKeyDown(Keys.K))
|
||||||
|
|||||||
@@ -65,12 +65,16 @@ namespace DepthsBelow
|
|||||||
var pfc = new PathFinder(this);
|
var pfc = new PathFinder(this);
|
||||||
AddComponent(pfc);
|
AddComponent(pfc);
|
||||||
|
|
||||||
var flashlight = new Flashlight(this);
|
var flashlight = new Flashlight(this)
|
||||||
|
{
|
||||||
|
Intensity = 0.8f
|
||||||
|
};
|
||||||
AddComponent(flashlight);
|
AddComponent(flashlight);
|
||||||
|
|
||||||
var stat = new Component.Stat(this)
|
var stat = new Component.Stat(this)
|
||||||
{
|
{
|
||||||
MaxHP = 100,
|
MaxHP = 100,
|
||||||
|
MaxPanic = 100,
|
||||||
//Life = 10,
|
//Life = 10,
|
||||||
Defence = 10,
|
Defence = 10,
|
||||||
Strength = 10,
|
Strength = 10,
|
||||||
@@ -92,7 +96,7 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
public static void LoadContent()
|
public static void LoadContent()
|
||||||
{
|
{
|
||||||
Texture = GameServices.GetService<ContentManager>().Load<Texture2D>("images/soldier3");
|
Texture = GameServices.GetService<ContentManager>().Load<Texture2D>("images/soldier5");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
|
|||||||
@@ -210,6 +210,20 @@
|
|||||||
<Processor>TextureProcessor</Processor>
|
<Processor>TextureProcessor</Processor>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="images\soldier5.png">
|
||||||
|
<Name>soldier5</Name>
|
||||||
|
<Importer>TextureImporter</Importer>
|
||||||
|
<Processor>TextureProcessor</Processor>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="images\lights\spot_wide.png">
|
||||||
|
<Name>spot_wide</Name>
|
||||||
|
<Importer>TextureImporter</Importer>
|
||||||
|
<Processor>TextureProcessor</Processor>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
@@ -111,11 +111,12 @@
|
|||||||
</data>
|
</data>
|
||||||
</layer>
|
</layer>
|
||||||
<objectgroup name="Object Layer 1" width="100" height="100">
|
<objectgroup name="Object Layer 1" width="100" height="100">
|
||||||
<object name="Start1" type="SquadStart" gid="2" x="384" y="352"/>
|
<object name="Start1" type="SquadStart" gid="2" x="480" y="320"/>
|
||||||
<object name="Start1" type="SquadStart" gid="2" x="416" y="352"/>
|
<object name="Start1" type="SquadStart" gid="2" x="544" y="320"/>
|
||||||
<object name="Start1" type="SquadStart" gid="2" x="384" y="384"/>
|
<object name="Start1" type="SquadStart" gid="2" x="480" y="384"/>
|
||||||
<object name="Start1" type="SquadStart" gid="2" x="416" y="384"/>
|
<object name="Start1" type="SquadStart" gid="2" x="544" y="384"/>
|
||||||
<object name="Monster1" type="MonsterSpawn" x="544" y="480"/>
|
<object name="Monster1" type="MonsterSpawn" x="544" y="480"/>
|
||||||
|
<object name="Start1" type="SquadStart" gid="2" x="608" y="352"/>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
<layer name="Collision" width="100" height="100">
|
<layer name="Collision" width="100" height="100">
|
||||||
<data encoding="csv">
|
<data encoding="csv">
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 40 KiB |
Reference in New Issue
Block a user