Skip to content
Snippets Groups Projects
Commit 2e10d1d0 authored by Trandinh Thien's avatar Trandinh Thien
Browse files

Added map

parent e5f64ab6
No related branches found
No related tags found
No related merge requests found
Showing
with 1569 additions and 2 deletions
XNA_GAME/Game Map.png

376 KiB

No preview for this file type
......@@ -46,19 +46,35 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Avatar, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Net, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Xna.Framework.Video, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Net" />
</ItemGroup>
<ItemGroup>
<Compile Include="cMovement.cs" />
<Compile Include="Mapcs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Program.cs" />
<Compile Include="Resource1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resource1.resx</DependentUpon>
</Compile>
<Compile Include="RunProgram.cs" />
<Compile Include="Game1.cs" />
</ItemGroup>
<ItemGroup>
......@@ -66,6 +82,8 @@
<Content Include="GameThumbnail.png">
<XnaPlatformSpecific>true</XnaPlatformSpecific>
</Content>
<None Include="Resources\GreenScreen.png" />
<None Include="Resources\Game Map.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Blaze_BrigadeContent\Blaze_BrigadeContent.contentproj">
......@@ -73,6 +91,12 @@
<XnaReferenceType>Content</XnaReferenceType>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resource1.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resource1.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<!--
......
Content\Game Map.xnb
Content\GreenScreen.xnb
......@@ -18,6 +18,7 @@ namespace Blaze_Brigade
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D backGround;
public Game1()
{
......@@ -46,6 +47,7 @@ namespace Blaze_Brigade
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
backGround = Content.Load<Texture2D>("Game Map");
// TODO: use this.Content to load your game content here
}
......@@ -71,6 +73,8 @@ namespace Blaze_Brigade
this.Exit();
// TODO: Add your update logic here
backGround = Content.Load<Texture2D>("Game Map");
base.Update(gameTime);
}
......@@ -83,8 +87,12 @@ namespace Blaze_Brigade
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null);
// TODO: Add your drawing code here
spriteBatch.Draw(backGround, Vector2.Zero, Color.White); //draws background
spriteBatch.End();
base.Draw(gameTime);
}
}
......
using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing;
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
namespace blandRPG
{
public class Map
{
#region Variables
private int[,] tilesPos;
private enum tiles { water, obstacle, grass, tree }; // type of tiles
private Texture2D background; // The background picture itself
private Vector2 position; // Position of character
//private Vector2 speed; //speed of character
private Vector2 tile; //x and y coordinates for tiles
private Boolean spawnMob;
Bitmap imgOld = new Bitmap(960, 960);
Bitmap compareImgOld = new Bitmap(960, 960);
Size newSize = new Size(32, 32);
//cMovement chaR;
//private int NumOfNPC;
//NPC_Creation npc;
#endregion Variables
#region Constructor
public Map(Texture2D background, cMovement movement)
{
//Sets the number of tiles and gives them in an array
tile.X = 32;
tile.Y = 32;
tilesPos = new int[(int)(tile.X), (int)(tile.Y)];
//chaR = movement;
parseMap();
spawnMob = true;
//npc = npcCreation;
//NumOfNPC = 3;
}
#endregion
#region Trail Map grid
//creates a tile grid for the map, automatic and independent of the actuall map right now
public void parseMap()
{
//Compares background
imgOld = (Bitmap)Blaze_Brigade.Resource1.Game_Map;
Bitmap img = new Bitmap((Image)imgOld, newSize);
compareImgOld = (Bitmap)Blaze_Brigade.Resource1.GreenScreen;
Bitmap compareImg = new Bitmap((Image)compareImgOld, newSize);
for (int i = 0; i < 32; i++)
{
for (int j = 0; j < 32; j++)
{
int Blue = (int)(Math.Abs(img.GetPixel(i, j).B - compareImg.GetPixel(i, j).B));
int Green = (int)(Math.Abs(img.GetPixel(i, j).G - compareImg.GetPixel(i, j).G));
int Red = (int)(Math.Abs(img.GetPixel(i, j).R - compareImg.GetPixel(i, j).R));
if (Green <= 80)
{
tilesPos[i, j] = Green;
}
else if (Red <= 20)
{
tilesPos[i, j] = Blue;
}
else
{
tilesPos[i, j] = Green;
}
Console.WriteLine(i + "," + j + ", Green:" + img.GetPixel(i, j).G + "," + compareImg.GetPixel(i, j).G + ", Red:" + img.GetPixel(i, j).R + "," + compareImg.GetPixel(i, j).R + ", Blue:" + img.GetPixel(i, j).B + "," + compareImg.GetPixel(i, j).B + ", Pos:" + tilesPos[i, j]);
}
}
//NOTE: Temporary adaptaion of the map
for (int i = 0; i < 1; i++)
{
for (int j = 0; j < 32; j++)
{
tilesPos[i, j] = 255;
}
}
for (int i = 31; i < 32; i++)
{
for (int j = 0; j < 32; j++)
{
tilesPos[i, j] = 255;
}
}
for (int i = 0; i < 32; i++)
{
for (int j = 31; j < 32; j++)
{
tilesPos[i, j] = 255;
}
}
for (int i = 0; i < 32; i++)
{
for (int j = 0; j < 1; j++)
{
tilesPos[i, j] = 255;
}
}
}
#endregion
}
}
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Blaze_Brigade {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resource1 {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resource1() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Blaze_Brigade.Resource1", typeof(Resource1).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Game_Map {
get {
object obj = ResourceManager.GetObject("Game_Map", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap GreenScreen {
get {
object obj = ResourceManager.GetObject("GreenScreen", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Game_Map" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Game Map.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="GreenScreen" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\GreenScreen.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file
src/Blaze-Brigade/Blaze_Brigade/Resources/Game Map.png

376 KiB

src/Blaze-Brigade/Blaze_Brigade/Resources/GreenScreen.png

32.1 KiB

......@@ -3,7 +3,7 @@ using System;
namespace Blaze_Brigade
{
#if WINDOWS || XBOX
static class Program
static class RunProgram
{
/// <summary>
/// The main entry point for the application.
......
File added
File added
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment