ДВЕРИ СПАВНЯТСЯ(+ белы квадраты)

This commit is contained in:
Mootfrost777 2023-08-18 18:31:45 +03:00
parent 447b8f0b10
commit d834423b7e
7 changed files with 74 additions and 52 deletions

View file

@ -21,18 +21,6 @@
/processorParam:TextureFormat=Compressed
/build:ButtonFont.spritefont
#begin checkboxs_off.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:checkboxs_off.png
#begin checkboxs_off-on.png
/importer:TextureImporter
/processor:TextureProcessor
@ -45,6 +33,18 @@
/processorParam:TextureFormat=Color
/build:checkboxs_off-on.png
#begin checkboxs_off.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:checkboxs_off.png
#begin checkboxs_on.png
/importer:TextureImporter
/processor:TextureProcessor
@ -81,14 +81,7 @@
/processorParam:TextureFormat=Color
/build:deathBackground.jpg
#begin DoomTestSong.mp3
/importer:Mp3Importer
/processor:SoundEffectProcessor
/processorParam:Quality=Best
/build:sounds/DoomTestSong.mp3
#begin doors.png
#begin door.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@ -98,7 +91,7 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:doors.png
/build:door.png
#begin Font_12.spritefont
/importer:FontDescriptionImporter
@ -243,6 +236,19 @@
/processorParam:TextureFormat=Color
/build:sliderBackground.png
#begin SmokeAnimation2.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:smokeAnimation2.png
#begin sounds/DoomTestSong.mp3
/importer:Mp3Importer
/processor:SoundEffectProcessor
@ -255,18 +261,6 @@
/processorParam:Quality=Best
/build:sounds/shotgun_shot.mp3
#begin smokeAnimation2.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:smokeAnimation2.png
#begin textboxbackground1-1.png
/importer:TextureImporter
/processor:TextureProcessor
@ -279,18 +273,6 @@
/processorParam:TextureFormat=Color
/build:textboxbackground1-1.png
#begin textboxbackground2,5-1.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:textboxbackground2,5-1.png
#begin textboxbackground2-1.png
/importer:TextureImporter
/processor:TextureProcessor
@ -303,6 +285,18 @@
/processorParam:TextureFormat=Color
/build:textboxbackground2-1.png
#begin textboxbackground2,5-1.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:textboxbackground2,5-1.png
#begin textboxbackground6-1.png
/importer:TextureImporter
/processor:TextureProcessor

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.10.2" name="Door" tilewidth="32" tileheight="48" tilecount="2" columns="2">
<image source="doors.png" width="64" height="48"/>
<image source="door.png" width="64" height="48"/>
</tileset>

View file

Before

Width:  |  Height:  |  Size: 472 B

After

Width:  |  Height:  |  Size: 472 B

View file

@ -612,7 +612,7 @@
<object id="46" type="LivingEntities.Monsters.Zombie" x="559" y="107">
<point/>
</object>
<object id="47" type="LivingEntities.Monsters.Slime" x="131" y="56">
<object id="47" type="LivingEntities.Monsters.Slime" x="131" y="41">
<point/>
</object>
<object id="48" type="LivingEntities.Monsters.Zombie" x="90" y="113">

View file

@ -21,7 +21,7 @@ namespace DangerousD.GameCore.GameObjects.Entities
Height = (int)size.Y;
}
protected override GraphicsComponent GraphicsComponent { get; } = new("doors");
protected override GraphicsComponent GraphicsComponent { get; } = new("door");
public override void Update(GameTime gameTime)
{

View file

@ -77,7 +77,7 @@ namespace DangerousD.GameCore
DebugHUD = new DebugHUD();
UIManager.resolution = resolution;
UIManager.resolutionInGame = inGameResolution;
currentMap = "lvl";
currentMap = "lvl2";
}
protected override void Initialize()

View file

@ -41,7 +41,7 @@ namespace DangerousD.GameCore.Managers
{
InstantiateTiles(layer, tileSize);
}
foreach (XmlNode layer in xml.DocumentElement.SelectNodes("objectgroup"))
{
InstantiateEntities(layer);
@ -91,16 +91,20 @@ namespace DangerousD.GameCore.Managers
private void InstantiateEntities(XmlNode group)
{
string entityGroup = group.Attributes["class"] is not null ? group.Attributes["class"].Value : "";
string entityGroup = group.Attributes["class"] is not null ? "." + group.Attributes["class"].Value : "";
Debug.Write(entityGroup);
float offsetX = group.Attributes["offsetx"] is not null ? float.Parse(group.Attributes["offsetx"].Value) : 0;
float offsetY = group.Attributes["offsety"] is not null ? float.Parse(group.Attributes["offsety"].Value) : 0;
foreach (XmlNode entity in group.ChildNodes)
{
string entityType = entity.Attributes["type"] is not null ? "." + entity.Attributes["type"].Value : "";
Type type = Type.GetType($"DangerousD.GameCore.GameObjects.{entityGroup}{entityType}");
Type type = Type.GetType($"DangerousD.GameCore.GameObjects{entityGroup}{entityType}");
Vector2 pos =
new Vector2(float.Parse(entity.Attributes["x"].Value, CultureInfo.InvariantCulture) + offsetX,
float.Parse(entity.Attributes["y"].Value, CultureInfo.InvariantCulture) + offsetY) * _scale;
Entity inst;
if (type.Equals(typeof(Player)))
{
@ -111,6 +115,30 @@ namespace DangerousD.GameCore.Managers
int gid = entity.Attributes["gid"] is not null ? int.Parse(entity.Attributes["gid"].Value) : 0;
inst = (Entity)Activator.CreateInstance(type, pos, new Vector2(32, 48), new Rectangle((gid - 872)*32, 0, 32, 48));
}
else if (type.Equals(typeof(TeleportingDoor)))
{
int gid = entity.Attributes["gid"] is not null ? int.Parse(entity.Attributes["gid"].Value) : 0;
XmlNode node = entity.SelectSingleNode("properties/property[@name = 'nextLevel']");
bool resetLevel = node is not null ? bool.Parse(node.Attributes["value"].Value) : false;
if (resetLevel)
{
inst = (Entity)Activator.CreateInstance(type, pos, new Vector2(32, 48), new Rectangle((gid - 872) * 32, 0, 32, 48),
new Vector2(0,0),
() => { });
}
else
{
node = entity.SelectSingleNode("properties/property[@name = 'destination']");
string target = node is not null ? node.Attributes["value"].Value : "0";
XmlNode dest = group.SelectSingleNode($"object[@id = '{target}']");
inst = (Entity)Activator.CreateInstance(type, pos, new Vector2(32, 48), new Rectangle((gid - 872) * 32, 0, 32, 48),
new Vector2(float.Parse(dest.Attributes["x"].Value, CultureInfo.InvariantCulture) + offsetX,
float.Parse(dest.Attributes["y"].Value, CultureInfo.InvariantCulture) + offsetY) * _scale,
() => { });
}
}
else
{
inst = (Entity)Activator.CreateInstance(type, pos);