Merge branch 'main' of https://github.com/progtime-net/DangerousD
This commit is contained in:
commit
a4e5998e9b
38 changed files with 557 additions and 176 deletions
BIN
.DS_Store
vendored
Normal file
BIN
.DS_Store
vendored
Normal file
Binary file not shown.
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0-windows</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
|
@ -17,13 +16,6 @@ namespace AnimationsFileCreator
|
||||||
Console.WriteLine("Добро пожаловать в костыльную программу по созданию файлов анимации для игры DungerousD");
|
Console.WriteLine("Добро пожаловать в костыльную программу по созданию файлов анимации для игры DungerousD");
|
||||||
Console.Write("Введите название текстуры (нажмите enter, чтобы выбрать файл во всплывающем окошке): ");
|
Console.Write("Введите название текстуры (нажмите enter, чтобы выбрать файл во всплывающем окошке): ");
|
||||||
string textureName = Console.ReadLine();
|
string textureName = Console.ReadLine();
|
||||||
if (textureName == "")
|
|
||||||
{
|
|
||||||
OpenFileDialog dialog = new OpenFileDialog();
|
|
||||||
dialog.ShowDialog();
|
|
||||||
textureName = dialog.FileName.Split('\\').Last();
|
|
||||||
textureName = textureName.Split('.')[0];
|
|
||||||
}
|
|
||||||
Console.WriteLine("Введите количество кадров анимации: ");
|
Console.WriteLine("Введите количество кадров анимации: ");
|
||||||
int framesCount = int.Parse(Console.ReadLine());
|
int framesCount = int.Parse(Console.ReadLine());
|
||||||
Console.WriteLine("Введите длительность кадра в анимации: ");
|
Console.WriteLine("Введите длительность кадра в анимации: ");
|
||||||
|
|
|
@ -140,7 +140,7 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:menuFon.jpg
|
/build:menuFon.jpg
|
||||||
|
|
||||||
#begin MenuFon2.jpg
|
#begin menuFon2.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
/processorParam:ResizeToPowerOfTwo=False
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
/processorParam:MakeSquare=False
|
/processorParam:MakeSquare=False
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:MenuFon2.jpg
|
/build:menuFon2.jpg
|
||||||
|
|
||||||
#begin menuFon3.jpg
|
#begin menuFon3.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
|
@ -255,7 +255,7 @@
|
||||||
/processorParam:Quality=Best
|
/processorParam:Quality=Best
|
||||||
/build:sounds/shotgun_shot.mp3
|
/build:sounds/shotgun_shot.mp3
|
||||||
|
|
||||||
#begin SmokeAnimation2.png
|
#begin smokeAnimation2.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
@ -265,7 +265,7 @@
|
||||||
/processorParam:ResizeToPowerOfTwo=False
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
/processorParam:MakeSquare=False
|
/processorParam:MakeSquare=False
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:SmokeAnimation2.png
|
/build:smokeAnimation2.png
|
||||||
|
|
||||||
#begin textboxbackground1-1.png
|
#begin textboxbackground1-1.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
|
|
1
DangerousD/Content/animations/DeathFromGhost
Normal file
1
DangerousD/Content/animations/DeathFromGhost
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"DeathFromGhost","textureName":"deathAnimation","startSpriteRectangle":{"X":1,"Y":246,"Width":48,"Height":48},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":5,"isCycle":false,"offset":"0, 0"}
|
1
DangerousD/Content/animations/DeathFromHunchman
Normal file
1
DangerousD/Content/animations/DeathFromHunchman
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"DeathFromHunchman","textureName":"deathAnimation","startSpriteRectangle":{"X":1,"Y":1,"Width":48,"Height":48},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":5,"isCycle":false,"offset":"0, 0"}
|
1
DangerousD/Content/animations/DeathFromSilasMaster
Normal file
1
DangerousD/Content/animations/DeathFromSilasMaster
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"DeathFromSilasMaster","textureName":"deathAnimation","startSpriteRectangle":{"X":1,"Y":295,"Width":48,"Height":48},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":5,"isCycle":false,"offset":"0, 0"}
|
1
DangerousD/Content/animations/DeathFromSlime
Normal file
1
DangerousD/Content/animations/DeathFromSlime
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"DeathFromSlime","textureName":"deathAnimation","startSpriteRectangle":{"X":1,"Y":50,"Width":48,"Height":48},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":5,"isCycle":false,"offset":"0, 0"}
|
1
DangerousD/Content/animations/DeathFromSpider
Normal file
1
DangerousD/Content/animations/DeathFromSpider
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"DeathFromSpider","textureName":"deathAnimation","startSpriteRectangle":{"X":1,"Y":148,"Width":48,"Height":48},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":5,"isCycle":false,"offset":"0, 0"}
|
1
DangerousD/Content/animations/DeathFromWerewolf
Normal file
1
DangerousD/Content/animations/DeathFromWerewolf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"DeathFromWerewolf","textureName":"deathAnimation","startSpriteRectangle":{"X":1,"Y":197,"Width":48,"Height":48},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":5,"isCycle":false,"offset":"0, 0"}
|
|
@ -1 +1 @@
|
||||||
{"id":"GhostAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":101,"Y":503,"Width":24,"Height":31},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":2,"isCycle":false,"offset":"0, 0"}
|
{"id":"GhostAttack","textureName":"MonstersAnimations","startSpriteRectangle":{"X":101,"Y":503,"Width":24,"Height":31},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":50,"framesCount":2,"isCycle":false,"offset":"0, 0"}
|
||||||
|
|
1
DangerousD/Content/animations/HunchmanMoveLeft.crash
Normal file
1
DangerousD/Content/animations/HunchmanMoveLeft.crash
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"HunchmanMoveLeft","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":124,"Width":24,"Height":24},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"}
|
1
DangerousD/Content/animations/HunchmanMoveRight.crash
Normal file
1
DangerousD/Content/animations/HunchmanMoveRight.crash
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"HunchmanMoveRight","textureName":"MonstersAnimations","startSpriteRectangle":{"X":1,"Y":100,"Width":24,"Height":23},"frameSecond":[{"Item1":0,"Item2":10}],"textureFrameInterval":1,"framesCount":4,"isCycle":true,"offset":"0, 0"}
|
1
DangerousD/Content/animations/playerShootBoomUpLeft
Normal file
1
DangerousD/Content/animations/playerShootBoomUpLeft
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"playerShootBoomUpLeft","textureName":"playerAnimation","startSpriteRectangle":{"X":267,"Y":34,"Width":24,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":2,"isCycle":false,"offset":"0, 0"}
|
24
DangerousD/Content/animations/playerShootBoomUpRight
Normal file
24
DangerousD/Content/animations/playerShootBoomUpRight
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"id": "playerShootBoomUpRight",
|
||||||
|
"textureName": "playerAnimation",
|
||||||
|
"startSpriteRectangle": {
|
||||||
|
"X": 267,
|
||||||
|
"Y": 1,
|
||||||
|
"Width": 24,
|
||||||
|
"Height": 32
|
||||||
|
},
|
||||||
|
"frameSecond": [
|
||||||
|
{
|
||||||
|
"Item1": 0,
|
||||||
|
"Item2": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Item1": 1,
|
||||||
|
"Item2": 20
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"textureFrameInterval": 1,
|
||||||
|
"framesCount": 2,
|
||||||
|
"isCycle": false,
|
||||||
|
"offset": "0, 0"
|
||||||
|
}
|
|
@ -734,7 +734,7 @@
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
<objectgroup id="10" name="Player" class="LivingEntities.Player">
|
<objectgroup id="10" name="Player" class="LivingEntities.Player">
|
||||||
<object id="47" x="-500" y="461.333">
|
<object id="47" x="0" y="461.333">
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
|
|
@ -1,3 +1,64 @@
|
||||||
|
<<<<<<< HEAD
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="200" height="200" tilewidth="16" tileheight="16" infinite="1" nextlayerid="5" nextobjectid="5">
|
||||||
|
<tileset firstgid="1" source="../Desktop/DangerousD map/map.tsx"/>
|
||||||
|
<layer id="1" name="Слой тайлов 1" class="StopTile" width="200" height="200">
|
||||||
|
<data encoding="csv">
|
||||||
|
<chunk x="-16" y="0" width="16" height="16">
|
||||||
|
294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
294,294,294,294,294,294,294,294,294,294,294,294,294,294,294,294
|
||||||
|
</chunk>
|
||||||
|
<chunk x="0" y="0" width="16" height="16">
|
||||||
|
294,294,294,294,294,321,321,321,321,321,321,321,321,321,321,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,321,321,321,321,321,321,321,321,321,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,321,
|
||||||
|
294,294,294,294,321,321,321,321,321,321,321,321,321,321,321,321
|
||||||
|
</chunk>
|
||||||
|
</data>
|
||||||
|
</layer>
|
||||||
|
<objectgroup id="2" name="Слой объектов 1" class="LivingEntities.Monsters.FlameSkull">
|
||||||
|
<object id="1" x="400" y="1000">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
</objectgroup>
|
||||||
|
<objectgroup id="3" name="Слой объектов 2" class="LivingEntities.Monsters.FrankBalls">
|
||||||
|
<object id="2" x="-162" y="160">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
</objectgroup>
|
||||||
|
<objectgroup id="4" name="Слой объектов 3" class="LivingEntities.Monsters.Hunchman">
|
||||||
|
<object id="3" x="300" y="230">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
</objectgroup>
|
||||||
|
</map>
|
||||||
|
=======
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="200" height="200" tilewidth="16" tileheight="16" infinite="1" nextlayerid="5" nextobjectid="5">
|
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="left-up" width="200" height="200" tilewidth="16" tileheight="16" infinite="1" nextlayerid="5" nextobjectid="5">
|
||||||
<tileset firstgid="1" source="../Desktop/DangerousD map/map.tsx"/>
|
<tileset firstgid="1" source="../Desktop/DangerousD map/map.tsx"/>
|
||||||
|
@ -71,5 +132,11 @@
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
|
<objectgroup id="6" name="Слой объектов 1" class="LivingEntities.Monsters.Ghost">
|
||||||
|
<object id="5" x="150" y="200">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
</objectgroup>
|
||||||
|
|
||||||
</map>
|
</map>
|
||||||
|
>>>>>>> main
|
||||||
|
|
Before Width: | Height: | Size: 464 KiB After Width: | Height: | Size: 464 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
25
DangerousD/DangerousD.sln
Normal file
25
DangerousD/DangerousD.sln
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 25.0.1705.7
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DangerousD", "DangerousD.csproj", "{A51FB3C2-D16C-42DF-B65A-6EC67AF07506}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{A51FB3C2-D16C-42DF-B65A-6EC67AF07506}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A51FB3C2-D16C-42DF-B65A-6EC67AF07506}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A51FB3C2-D16C-42DF-B65A-6EC67AF07506}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A51FB3C2-D16C-42DF-B65A-6EC67AF07506}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {F6C9C555-FA45-4C6A-BEB3-8352B2653CB0}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -23,7 +23,7 @@ internal class DeathGUI : AbstractGui
|
||||||
Elements.Add(butMenu);
|
Elements.Add(butMenu);
|
||||||
butMenu.LeftButtonPressed += () =>
|
butMenu.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
AppManager.Instance.Restart("lvl");
|
||||||
};
|
};
|
||||||
foreach (var item in Elements)
|
foreach (var item in Elements)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,12 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected int obsticles = 0;
|
||||||
|
public virtual void OnCollisionWithObsticle(GameObject gameObject)
|
||||||
|
{
|
||||||
|
obsticles++;//SD
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -53,6 +59,7 @@ namespace DangerousD.GameCore
|
||||||
|
|
||||||
public virtual void Update(GameTime gameTime)
|
public virtual void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
obsticles = 0;
|
||||||
GraphicsComponent.Update();
|
GraphicsComponent.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
|
|
||||||
public abstract void Move(GameTime gameTime);
|
public abstract void Move(GameTime gameTime);
|
||||||
|
|
||||||
public void TakeDamage(int damage)
|
public virtual void TakeDamage()
|
||||||
{
|
{
|
||||||
monster_health -= damage;
|
monster_health--;
|
||||||
if (monster_health <= 0)
|
if (monster_health <= 0)
|
||||||
{
|
{
|
||||||
Death();
|
Death();
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using DangerousD.GameCore.GameObjects.MapObjects;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
|
@ -17,21 +18,23 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
private bool isFlyRight = true;
|
private bool isFlyRight = true;
|
||||||
private bool isFlyUp = true;
|
private bool isFlyUp = true;
|
||||||
private bool isAttacking = false;
|
private bool isAttacking = false;
|
||||||
|
private int hp;
|
||||||
|
|
||||||
public Rectangle Collision
|
public Rectangle Collision
|
||||||
{
|
{
|
||||||
get { return collision; }
|
get { return collision; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public FrankBalls(Vector2 position) : base(position)
|
public FrankBalls(Vector2 position) : base(new Vector2(300, 200))
|
||||||
{
|
{
|
||||||
this.position = position;
|
|
||||||
name = "FrankBalls";
|
name = "FrankBalls";
|
||||||
Width = 40;
|
Width = 40;
|
||||||
Height = 40;
|
Height = 40;
|
||||||
monster_speed = 3;
|
monster_speed = 3;
|
||||||
velocity = new Vector2(3,-3);
|
velocity = new Vector2(3,-3);
|
||||||
acceleration = Vector2.Zero;
|
acceleration = Vector2.Zero;
|
||||||
|
velocity = new Vector2(monster_speed, monster_speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "BallMoveRight" }, "BallMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "BallMoveRight" }, "BallMoveRight");
|
||||||
|
@ -39,7 +42,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
AppManager.Instance.DebugHUD.Set(name, velocity.ToString());
|
|
||||||
|
Death();
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
|
@ -60,12 +65,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
if (hp <= 0)
|
||||||
|
{
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
var getColsHor = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
var getColsHor = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
||||||
var getColsVer= AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2)); ;
|
var getColsVer= AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2)); ;
|
||||||
if (isFlyRight)
|
if (isFlyRight)
|
||||||
|
@ -75,6 +82,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
isFlyRight = false;
|
isFlyRight = false;
|
||||||
velocity.X = -velocity.X;
|
velocity.X = -velocity.X;
|
||||||
|
hp--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -84,6 +92,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
isFlyRight = true;
|
isFlyRight = true;
|
||||||
velocity.X = -velocity.X;
|
velocity.X = -velocity.X;
|
||||||
|
hp--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isFlyUp)
|
if (isFlyUp)
|
||||||
|
@ -94,6 +103,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
isFlyUp = false;
|
isFlyUp = false;
|
||||||
velocity.Y = -velocity.Y;
|
velocity.Y = -velocity.Y;
|
||||||
|
hp--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -103,6 +113,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
isFlyUp = true;
|
isFlyUp = true;
|
||||||
velocity.Y = -velocity.Y;
|
velocity.Y = -velocity.Y;
|
||||||
|
hp--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
isGoRight = true;
|
isGoRight = true;
|
||||||
monster_speed = 3;
|
monster_speed = 3;
|
||||||
name = "Ghost";
|
name = "Ghost";
|
||||||
Width = 48;
|
Width = 24;
|
||||||
Height = 62;
|
Height = 30;
|
||||||
GraphicsComponent.StartAnimation("GhostSpawn");
|
GraphicsComponent.StartAnimation("GhostSpawn");
|
||||||
acceleration = Vector2.Zero;
|
acceleration = new Vector2(0,1);
|
||||||
|
monster_health = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "GhostMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "GhostMoveRight", "GhostMoveLeft", "GhostSpawn", "GhostAttack" }, "GhostMoveRight");
|
||||||
|
@ -38,13 +38,32 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
|
velocity.X = 0;
|
||||||
|
isAttack = true;
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "GhostAttack")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("GhostAttack");
|
||||||
|
}
|
||||||
|
|
||||||
|
AppManager.Instance.GameManager.players[0].Death(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
if (gameObject is Player)
|
||||||
|
{
|
||||||
|
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
||||||
|
{
|
||||||
|
Attack();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
base.OnCollision(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
@ -64,17 +83,24 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
velocity.X = -monster_speed;
|
velocity.X = -monster_speed;
|
||||||
}
|
}
|
||||||
if (Pos.X >= rightBoarder)
|
var getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
||||||
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
isGoRight = false;
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, Width + 4, 2));
|
||||||
}
|
}
|
||||||
else if (Pos.X <= leftBoarder)
|
else
|
||||||
{
|
{
|
||||||
isGoRight = true;
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 3, (int)Pos.Y + Height / 2 - 2, Width + 3, 2));
|
||||||
}
|
}
|
||||||
if (true)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var item in getCols)
|
||||||
|
{
|
||||||
|
if (item is MapObject)
|
||||||
|
{
|
||||||
|
isGoRight = !isGoRight;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,8 +108,21 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void TakeDamage()
|
||||||
|
{
|
||||||
|
monster_health--;
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
public override void Target()
|
public override void Target()
|
||||||
|
=======
|
||||||
|
|
||||||
|
if (monster_health <= 0)
|
||||||
|
{
|
||||||
|
Death();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Target()
|
||||||
|
>>>>>>> f415b47fc4b84d2c5aaa94f02641c9b075f9f3f8
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,129 +9,130 @@ using System.Linq;
|
||||||
using System.Security.Authentication.ExtendedProtection;
|
using System.Security.Authentication.ExtendedProtection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using DangerousD.GameCore.Managers;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class Hunchman : CoreEnemy
|
public class Hunchman : CoreEnemy
|
||||||
{
|
{
|
||||||
GameManager gameManager;
|
private bool isGoRight = false;
|
||||||
bool isAttacking;
|
private bool isAttaking = false;
|
||||||
|
private bool isTarget = false;
|
||||||
|
private bool isVisible = true;
|
||||||
|
float leftBoarder;
|
||||||
|
float rightBoarder;
|
||||||
|
|
||||||
|
PhysicsManager physicsManager;
|
||||||
public Hunchman(Vector2 position) : base(position)
|
public Hunchman(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
Width = 48;
|
Width = 20;
|
||||||
Height = 48;
|
Height = 30;
|
||||||
monster_speed = -2;
|
leftBoarder = (int)position.X - 100;
|
||||||
monster_health = 1;
|
rightBoarder = (int)position.X + 100;
|
||||||
name = "HunchMan";
|
name = "Hunchman";
|
||||||
velocity = new Vector2(monster_speed, 0);
|
GraphicsComponent.StartAnimation("HunchmanMoveLeft");
|
||||||
gameManager = AppManager.Instance.GameManager;
|
monster_speed = 3;
|
||||||
isAttacking = false;
|
physicsManager = new PhysicsManager();
|
||||||
isAlive = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string>
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string>
|
||||||
{ "HunchmanMoveLeft", "HunchmanMoveRight", "HunchmanAttackLeft", "HunchmanAttackRight" }, "HunchmanMoveLeft");
|
{ "HunchmanMoveLeft", "HunchmanMoveRight", "HunchmanAttackLeft", "HunchmanAttackRight" }, "HunchmanMoveLeft");
|
||||||
|
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
// P.S. Всё в классе можешь смело удалять и переписывать с нуля.
|
if (!isAttaking)
|
||||||
gameManager = AppManager.Instance.GameManager;
|
|
||||||
|
|
||||||
if (!isAttacking)
|
|
||||||
{
|
{
|
||||||
Attack();
|
Target();
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
}
|
}
|
||||||
else
|
base.Update(gameTime);
|
||||||
{
|
|
||||||
velocity.X = 0;
|
|
||||||
}
|
|
||||||
Death();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
GameObject gameObject;
|
var animation = GraphicsComponent.GetCurrentAnimation;
|
||||||
foreach (var player in gameManager.players)
|
isAttaking = true;
|
||||||
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
if (player.Pos.Y + player.Height >= Pos.Y && player.Pos.Y <= Pos.Y + Height)
|
if (animation != "HunchmanAttackRight")
|
||||||
{
|
{
|
||||||
gameObject = gameManager.physicsManager.RayCast(this, player);
|
GraphicsComponent.StartAnimation("HunchmanAttackRight");
|
||||||
if (gameObject is null)
|
|
||||||
{
|
|
||||||
isAttacking = true;
|
|
||||||
GraphicsComponent.StopAnimation();
|
|
||||||
if (velocity.X > 0)
|
|
||||||
{
|
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "HunchmanAttackRight")
|
|
||||||
{
|
|
||||||
GraphicsComponent.StartAnimation("HunchmanAttackRight");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (velocity.X < 0)
|
|
||||||
{
|
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "HunchmanAttackLeft")
|
|
||||||
{
|
|
||||||
GraphicsComponent.StartAnimation("HunchmanAttackLeft");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
HunchmanDagger hunchmanDagger = new HunchmanDagger(Pos,isGoRight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (animation != "HunchmanAttackLeft")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("HunchmanAttackLeft");
|
||||||
|
}
|
||||||
|
HunchmanDagger hunchmanDagger = new HunchmanDagger(Pos, isGoRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
Particle particle = new Particle(Pos);
|
||||||
|
}
|
||||||
|
|
||||||
if (monster_health <= 0)
|
if (monster_health <= 0)
|
||||||
{
|
{
|
||||||
|
isVisible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
if (gameManager.physicsManager.RayCast(this, new Vector2(Pos.X + Width + 10, Pos.Y + Height)) is not null)
|
velocity.X = 0;
|
||||||
|
var animation = GraphicsComponent.GetCurrentAnimation;
|
||||||
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
monster_speed *= -1;
|
if (animation != "HunchmanMoveRight")
|
||||||
}
|
|
||||||
|
|
||||||
velocity.X = monster_speed;
|
|
||||||
|
|
||||||
if (velocity.X > 0)
|
|
||||||
{
|
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "HunchmanMoveRight")
|
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("HunchmanMoveRight");
|
GraphicsComponent.StartAnimation("HunchmanMoveRight");
|
||||||
}
|
}
|
||||||
|
velocity.X = monster_speed;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
else if (velocity.X < 0)
|
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "HunchmanMoveLeft")
|
if (animation != "HunchmanMoveLeft")
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("HunchmanMoveLeft");
|
GraphicsComponent.StartAnimation("HunchmanMoveLeft");
|
||||||
}
|
}
|
||||||
|
velocity.X = -monster_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_pos.X >= rightBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = false;
|
||||||
|
}
|
||||||
|
else if (_pos.X <= leftBoarder)
|
||||||
|
{
|
||||||
|
isGoRight = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnCollision(GameObject gameObject)
|
|
||||||
{
|
|
||||||
monster_speed *= -1;
|
|
||||||
_pos.X += 5 * monster_speed;
|
|
||||||
Debug.WriteLine("Collision");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Target()
|
public override void Target()
|
||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
=======
|
||||||
|
var player = AppManager.Instance.GameManager.players[0];
|
||||||
|
|
||||||
|
if (physicsManager.RayCast(this, player) == null)
|
||||||
|
{
|
||||||
|
Attack();
|
||||||
|
}
|
||||||
|
>>>>>>> f415b47fc4b84d2c5aaa94f02641c9b075f9f3f8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,10 +12,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class HunchmanDagger : CoreEnemy
|
public class HunchmanDagger : CoreEnemy
|
||||||
{
|
{
|
||||||
public HunchmanDagger(Vector2 position) : base(position)
|
private bool isGoRight = false;
|
||||||
|
|
||||||
|
public HunchmanDagger(Vector2 position, bool isGoRight) : base(position)
|
||||||
{
|
{
|
||||||
|
this.isGoRight = isGoRight;
|
||||||
name = "Hunchman";
|
name = "Hunchman";
|
||||||
monster_speed = 1;
|
monster_speed = 4;
|
||||||
Width = 9;
|
Width = 9;
|
||||||
Height = 6;
|
Height = 6;
|
||||||
}
|
}
|
||||||
|
@ -34,12 +37,46 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
velocity.X = 0;
|
||||||
|
var getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle(0, 0, 0, 0));
|
||||||
|
if (isGoRight)
|
||||||
|
{
|
||||||
|
StartCicycleAnimation("HunchmanDaggerRight");
|
||||||
|
velocity.X = monster_speed;
|
||||||
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y, Width+5, Height));
|
||||||
|
if(getCols.Count>0)
|
||||||
|
{
|
||||||
|
Death();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (!isGoRight)
|
||||||
|
{
|
||||||
|
StartCicycleAnimation("HunchmanDaggerLeft");
|
||||||
|
velocity.X = -monster_speed;
|
||||||
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X-5, (int)Pos.Y, Width + 5, Height));
|
||||||
|
if (getCols.Count > 0)
|
||||||
|
{
|
||||||
|
Death();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
if (gameObject is Player)
|
||||||
|
{
|
||||||
|
AppManager.Instance.GameManager.players[0].Death(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.OnCollision(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Target()
|
public override void Target()
|
||||||
|
|
|
@ -173,7 +173,11 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Particle particle = new Particle(Pos);
|
||||||
|
|
||||||
|
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
|
@ -220,7 +224,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
velocity.X = -monster_speed;
|
velocity.X = -monster_speed;
|
||||||
|
|
||||||
}
|
}
|
||||||
var getCols= AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2)); ;
|
var getCols= AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
||||||
if (isGoRight)
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 51, 2));
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 51, 2));
|
||||||
|
@ -348,5 +352,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
}
|
}
|
||||||
|
public void TakeDamage()
|
||||||
|
{
|
||||||
|
monster_health--;
|
||||||
|
|
||||||
|
Particle particle = new Particle(Pos);
|
||||||
|
if (monster_health <= 0)
|
||||||
|
{
|
||||||
|
Death();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,24 +12,33 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class Werewolf : CoreEnemy
|
public class Werewolf : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isAttack;
|
private bool isJump;
|
||||||
|
int delay;
|
||||||
|
|
||||||
public Werewolf(Vector2 position) : base(position)
|
public Werewolf(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
name = "Wolf";
|
name = "Wolf";
|
||||||
monster_speed = 4;
|
monster_speed = 3;
|
||||||
Width = 78;
|
Width = 39;
|
||||||
Height = 96;
|
Height = 48;
|
||||||
|
delay = 10;
|
||||||
|
monster_health = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "WolfMoveRight", "WolfMoveLeft", "WolfJumpRight", "WolfJumpLeft" }, "WolfMoveRight");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "WolfMoveRight", "WolfMoveLeft", "WolfJumpRight", "WolfJumpLeft" }, "WolfMoveRight");
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
if (!isAttack)
|
if(!isJump )
|
||||||
|
{
|
||||||
|
Jump();
|
||||||
|
}
|
||||||
|
if(isOnGround)
|
||||||
{
|
{
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
@ -41,11 +50,18 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
|
|
||||||
public override void Death()
|
public override void Death()
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
Particle particle = new Particle(Pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Move(GameTime gameTime)
|
public override void Move(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
isJump = false;
|
||||||
|
|
||||||
if (isGoRight)
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "WolfMoveRight")
|
if (GraphicsComponent.GetCurrentAnimation != "WolfMoveRight")
|
||||||
|
@ -62,23 +78,94 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
velocity.X = -monster_speed;
|
velocity.X = -monster_speed;
|
||||||
}
|
}
|
||||||
if (Pos.X >= rightBoarder)
|
var getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
||||||
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
isGoRight = false;
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, Width+4, 2));
|
||||||
}
|
}
|
||||||
else if (Pos.X <= leftBoarder)
|
else
|
||||||
{
|
{
|
||||||
isGoRight = true;
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - 3, (int)Pos.Y + Height / 2 - 2, Width +3, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var item in getCols)
|
||||||
|
{
|
||||||
|
if (item is MapObject)
|
||||||
|
{
|
||||||
|
isGoRight = !isGoRight;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
public override void Target()
|
public override void Target()
|
||||||
|
=======
|
||||||
|
public void Jump()
|
||||||
|
{
|
||||||
|
var getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y + Height / 2 - 2, 50, 2));
|
||||||
|
if (isGoRight)
|
||||||
|
{
|
||||||
|
getCols= AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)Pos.Y, Width+100, Height),false);
|
||||||
|
if(getCols.Count > 0)
|
||||||
|
{
|
||||||
|
isJump = true;
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "WolfJumpRight")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("WolfJumpRight");
|
||||||
|
}
|
||||||
|
velocity.Y = -7;
|
||||||
|
velocity.X = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getCols = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X-100, (int)Pos.Y, 100, Height), false);
|
||||||
|
if (getCols.Count > 0)
|
||||||
|
{
|
||||||
|
isJump = true;
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "WolfJumpLeft")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("WolfJumpLeft");
|
||||||
|
}
|
||||||
|
velocity.Y = -7;
|
||||||
|
velocity.X = -6;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
/*/if (gameObject is Player)
|
||||||
|
{
|
||||||
|
if (AppManager.Instance.GameManager.players[0].IsAlive)
|
||||||
|
{
|
||||||
|
AppManager.Instance.GameManager.players[0].Death(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
base.OnCollision(gameObject);/*/
|
||||||
|
}
|
||||||
|
public void Target()
|
||||||
|
>>>>>>> f415b47fc4b84d2c5aaa94f02641c9b075f9f3f8
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void TakeDamage()
|
||||||
|
{
|
||||||
|
monster_health--;
|
||||||
|
|
||||||
|
Particle particle = new Particle(Pos);
|
||||||
|
if (monster_health <= 0)
|
||||||
|
{
|
||||||
|
Death();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
public class Zombie : CoreEnemy
|
public class Zombie : CoreEnemy
|
||||||
{
|
{
|
||||||
private bool isAttack;
|
|
||||||
|
|
||||||
float leftBorder;
|
float leftBorder;
|
||||||
float rightBorder;
|
float rightBorder;
|
||||||
|
@ -32,6 +31,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
rightBorder = (int)position.X + 100;
|
rightBorder = (int)position.X + 100;
|
||||||
physicsManager = new PhysicsManager();
|
physicsManager = new PhysicsManager();
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
|
monster_health = 2;
|
||||||
if(random.Next(0, 2) == 0)
|
if(random.Next(0, 2) == 0)
|
||||||
{
|
{
|
||||||
isGoRight = true;
|
isGoRight = true;
|
||||||
|
@ -58,18 +58,19 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
Target();
|
Target();
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
}
|
}
|
||||||
fixBorder();
|
//fixBorder();
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Attack()
|
public override void Attack()
|
||||||
{
|
{
|
||||||
AppManager.Instance.GameManager.GetPlayer1.Death(name);
|
isAttaking = true;
|
||||||
|
PlayAttackAnimation();
|
||||||
|
AppManager.Instance.GameManager.GetClosestPlayer(Pos).Death(name);
|
||||||
}
|
}
|
||||||
public void PlayAttackAnimation()
|
public void PlayAttackAnimation()
|
||||||
{
|
{
|
||||||
velocity.X = 0;
|
velocity.X = 0;
|
||||||
isAttaking = true;
|
|
||||||
if (isGoRight)
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "ZombieRightAttack")
|
if (GraphicsComponent.GetCurrentAnimation != "ZombieRightAttack")
|
||||||
|
@ -123,7 +124,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
}
|
}
|
||||||
public override void OnCollision(GameObject gameObject)
|
public override void OnCollision(GameObject gameObject)
|
||||||
{
|
{
|
||||||
if (gameObject.id == AppManager.Instance.GameManager.GetPlayer1.id && AppManager.Instance.GameManager.GetPlayer1.IsAlive)
|
if (gameObject.id == AppManager.Instance.GameManager.GetClosestPlayer(Pos).id && AppManager.Instance.GameManager.GetClosestPlayer(Pos).IsAlive)
|
||||||
{
|
{
|
||||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.Client)
|
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.Client)
|
||||||
{
|
{
|
||||||
|
@ -183,10 +184,9 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
public override void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public void TakeDamage()
|
public override void TakeDamage()
|
||||||
{
|
{
|
||||||
monster_health--;
|
monster_health--;
|
||||||
GraphicsComponent.StartAnimation("ZombieRightAttack");
|
|
||||||
Particle particle = new Particle(Pos);
|
Particle particle = new Particle(Pos);
|
||||||
if (monster_health <= 0)
|
if (monster_health <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,14 +25,15 @@ namespace DangerousD.GameCore.GameObjects.PlayerDeath
|
||||||
|
|
||||||
private void PlayDeath(string deathName)
|
private void PlayDeath(string deathName)
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "DeathFromZombie")
|
//if (GraphicsComponent.GetCurrentAnimation != "DeathFromZombie")
|
||||||
{
|
//{
|
||||||
GraphicsComponent.StartAnimation("DeathFromZombie");
|
// GraphicsComponent.StartAnimation("DeathFromZombie");
|
||||||
}
|
//}
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "DeathFromSilasHand")
|
//if (GraphicsComponent.GetCurrentAnimation != "DeathFromSilasHand")
|
||||||
{
|
//{
|
||||||
GraphicsComponent.StartAnimation("DeathFromSilasHand");
|
// GraphicsComponent.StartAnimation("DeathFromSilasHand");
|
||||||
}
|
//}
|
||||||
|
GraphicsComponent.StartAnimation(deathName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ using Microsoft.Xna.Framework.Input;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using DangerousD.GameCore.GameObjects.LivingEntities.Monsters;
|
using DangerousD.GameCore.GameObjects.LivingEntities.Monsters;
|
||||||
using DangerousD.GameCore.Network;
|
using DangerousD.GameCore.Network;
|
||||||
|
using DangerousD.GameCore.GameObjects.MapObjects;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GameObjects.LivingEntities
|
namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
|
@ -65,6 +66,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
bullets++;
|
bullets++;
|
||||||
}
|
}
|
||||||
|
if(a == "playerShootBoomUpRight" || a == "playerShootBoomUpLeft")
|
||||||
|
{
|
||||||
|
isShooting = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +78,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public bool IsAlive { get { return isAlive; } }
|
public bool IsAlive { get { return isAlive; } }
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft",
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft", "playerMoveRight", "DeathFromZombie", "playerRightStay", "playerStayLeft",
|
||||||
"playerJumpRight" , "playerJumpLeft", "playerShootLeft", "playerShootRight", "playerReload", "smokeAfterShoot", "playerShootUpRight", "playerShootUpLeft"}, "playerReload");
|
"playerJumpRight" , "playerJumpLeft", "playerShootLeft", "playerShootRight", "playerReload", "smokeAfterShoot", "playerShootUpRight", "playerShootUpLeft", "playerShootBoomUpRight",
|
||||||
|
"playerShootBoomUpLeft"}, "playerReload");
|
||||||
|
|
||||||
public void Attack()
|
public void Attack()
|
||||||
{
|
{
|
||||||
|
@ -184,41 +190,45 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
bullets--;
|
bullets--;
|
||||||
if (isRight)
|
if (isRight)
|
||||||
{
|
{
|
||||||
StartCicycleAnimation("playerShootRight");
|
if (!isUping)
|
||||||
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)(Pos.Y - 10f), shootLength + 24, 10), typeof(Zombie)).OrderBy(x => (x.Pos - Pos).LengthSquared());
|
|
||||||
if (targets.Count() > 0)
|
|
||||||
{
|
{
|
||||||
Zombie targetZombie = (Zombie)targets.First();
|
StartCicycleAnimation("playerShootRight");
|
||||||
targetZombie.TakeDamage();
|
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)(Pos.Y - 10f), shootLength + 24, 10), typeof(Zombie)).OrderBy(x => (x.Pos - Pos).LengthSquared());
|
||||||
|
if (targets.Count() > 0)
|
||||||
}
|
|
||||||
targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(GetShootRectangle(isRight), typeof(SilasHands)).OrderBy(x => (x.Pos - Pos).LengthSquared());
|
|
||||||
if (targets.Count() > 0)
|
|
||||||
{
|
|
||||||
SilasHands targetHand = (SilasHands)targets.First();
|
|
||||||
targetHand.TakeDamage();
|
|
||||||
}
|
|
||||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StartCicycleAnimation("playerShootLeft");
|
|
||||||
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - shootLength, (int)(Pos.Y - 10f), shootLength, 10), typeof(Zombie));
|
|
||||||
if (targets != null)
|
|
||||||
{
|
|
||||||
foreach (var target in targets)
|
|
||||||
{
|
{
|
||||||
Zombie targetZombie = (Zombie)target;
|
Zombie targetZombie = (Zombie)targets.First();
|
||||||
targetZombie.TakeDamage();
|
targetZombie.TakeDamage();
|
||||||
}
|
}
|
||||||
|
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
||||||
}
|
}
|
||||||
targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(GetShootRectangle(isRight), typeof(SilasHands));
|
else
|
||||||
if (targets.Count() > 0)
|
|
||||||
{
|
{
|
||||||
SilasHands targetHand = (SilasHands)targets.First();
|
StartCicycleAnimation("playerShootBoomUpRight");
|
||||||
targetHand.TakeDamage();
|
Bullet bullet = new Bullet(new Vector2(Pos.X + 16, Pos.Y));
|
||||||
|
bullet.ShootUpRight();
|
||||||
|
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 12, Pos.Y - 8));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!isRight)
|
||||||
|
{
|
||||||
|
if (!isUping)
|
||||||
|
{
|
||||||
|
StartCicycleAnimation("playerShootLeft");
|
||||||
|
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)(Pos.Y - 10f), shootLength + 24, 10), typeof(Zombie)).OrderBy(x => (x.Pos - Pos).LengthSquared());
|
||||||
|
if (targets.Count() > 0)
|
||||||
|
{
|
||||||
|
Zombie targetZombie = (Zombie)targets.First();
|
||||||
|
targetZombie.TakeDamage();
|
||||||
|
}
|
||||||
|
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
StartCicycleAnimation("playerShootBoomUpLeft");
|
||||||
|
Bullet bullet = new Bullet(new Vector2(Pos.X, Pos.Y));
|
||||||
|
bullet.ShootUpLeft();
|
||||||
|
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 6, Pos.Y - 7));
|
||||||
}
|
}
|
||||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,14 +292,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
else if (AppManager.Instance.InputManager.VectorMovementDirection.X == 0)//стоит
|
else if (AppManager.Instance.InputManager.VectorMovementDirection.X == 0)//стоит
|
||||||
{
|
{
|
||||||
if(bullets < 5)
|
if (isRight)
|
||||||
{
|
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "playerReload")
|
|
||||||
{
|
|
||||||
GraphicsComponent.StartAnimation("playerReload");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (isRight)
|
|
||||||
{
|
{
|
||||||
if (isUping)
|
if (isUping)
|
||||||
{
|
{
|
||||||
|
@ -298,6 +301,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
GraphicsComponent.StartAnimation("playerShootUpRight");
|
GraphicsComponent.StartAnimation("playerShootUpRight");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (bullets < 5)
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "playerReload")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("playerReload");
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("playerRightStay");
|
GraphicsComponent.StartAnimation("playerRightStay");
|
||||||
|
@ -312,6 +322,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
GraphicsComponent.StartAnimation("playerShootUpLeft");
|
GraphicsComponent.StartAnimation("playerShootUpLeft");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (bullets < 5)
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "playerReload")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("playerReload");
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("playerStayLeft");
|
GraphicsComponent.StartAnimation("playerStayLeft");
|
||||||
|
@ -331,13 +348,51 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
isOnGround = false;
|
isOnGround = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Bullet : GameObjects.LivingEntity
|
public class Bullet : LivingEntity
|
||||||
{
|
{
|
||||||
public Bullet(Vector2 position) : base(position)
|
public Bullet(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
|
Height = 5;
|
||||||
|
Width = 5;
|
||||||
|
}
|
||||||
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "playerMoveLeft"}, "playerMoveLeft");
|
||||||
|
Vector2 direction;
|
||||||
|
Vector2 maindirection;
|
||||||
|
public void ShootUpRight()
|
||||||
|
{
|
||||||
|
direction = new Vector2(1, -1);
|
||||||
|
acceleration = Vector2.Zero;
|
||||||
|
velocity = new Vector2(10, 10) * direction;
|
||||||
|
maindirection = velocity;
|
||||||
|
}
|
||||||
|
public void ShootUpLeft()
|
||||||
|
{
|
||||||
|
direction = new Vector2(-1, -1);
|
||||||
|
acceleration = Vector2.Zero;
|
||||||
|
velocity = new Vector2(10, 10) * direction;
|
||||||
|
maindirection = velocity;
|
||||||
|
}
|
||||||
|
public override void OnCollision(GameObject gameObject)
|
||||||
|
{
|
||||||
|
if (gameObject is not Player)
|
||||||
|
{
|
||||||
|
if (gameObject is CoreEnemy)
|
||||||
|
{
|
||||||
|
CoreEnemy enemy = (CoreEnemy)gameObject;
|
||||||
|
enemy.TakeDamage();
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
}
|
||||||
|
base.OnCollision(gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
if (maindirection!=velocity)
|
||||||
|
{
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
}
|
||||||
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new("ZombieMoveLeft");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@ public abstract class LivingEntity : Entity
|
||||||
public Vector2 velocity;
|
public Vector2 velocity;
|
||||||
public Vector2 acceleration;
|
public Vector2 acceleration;
|
||||||
|
|
||||||
|
public Vector2 Acceleration { get; private set; }
|
||||||
|
|
||||||
public LivingEntity(Vector2 position) : base(position)
|
public LivingEntity(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
acceleration = new Vector2(0, 30);
|
acceleration = new Vector2(0, 30);
|
||||||
|
|
|
@ -236,7 +236,7 @@ namespace DangerousD.GameCore.Graphics
|
||||||
|
|
||||||
private void SetInterval()
|
private void SetInterval()
|
||||||
{
|
{
|
||||||
Tuple<int, int> i = currentAnimation.FrameTime.Find(x => x.Item1 == currentFrame);
|
Tuple<int, int> i = currentAnimation.FrameTime.Find(x => x.Item1 == currentFrame);
|
||||||
if (i != null)
|
if (i != null)
|
||||||
{
|
{
|
||||||
interval = i.Item2;
|
interval = i.Item2;
|
||||||
|
|
|
@ -209,6 +209,7 @@ namespace DangerousD.GameCore
|
||||||
break;
|
break;
|
||||||
case GameState.Game:
|
case GameState.Game:
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
GameManager.mapManager.LoadLevel("map");
|
GameManager.mapManager.LoadLevel("map");
|
||||||
=======
|
=======
|
||||||
|
@ -220,6 +221,9 @@ namespace DangerousD.GameCore
|
||||||
=======
|
=======
|
||||||
GameManager.mapManager.LoadLevel("lvl");
|
GameManager.mapManager.LoadLevel("lvl");
|
||||||
>>>>>>> 211eac278c07f06a177b7be1fc84dd05cbf5c449
|
>>>>>>> 211eac278c07f06a177b7be1fc84dd05cbf5c449
|
||||||
|
=======
|
||||||
|
GameManager.mapManager.LoadLevel(currentMap);
|
||||||
|
>>>>>>> f415b47fc4b84d2c5aaa94f02641c9b075f9f3f8
|
||||||
GameManager.FindBorders();
|
GameManager.FindBorders();
|
||||||
break;
|
break;
|
||||||
case GameState.Death:
|
case GameState.Death:
|
||||||
|
@ -337,7 +341,9 @@ namespace DangerousD.GameCore
|
||||||
}
|
}
|
||||||
public void Restart(string map)
|
public void Restart(string map)
|
||||||
{
|
{
|
||||||
|
GameManager = new();
|
||||||
|
ChangeGameState(GameState.Menu);
|
||||||
|
currentMap = map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace DangerousD.GameCore
|
||||||
internal void Register(GameObject gameObject)
|
internal void Register(GameObject gameObject)
|
||||||
{
|
{
|
||||||
GetAllGameObjects.Add(gameObject);
|
GetAllGameObjects.Add(gameObject);
|
||||||
|
|
||||||
if (gameObject is Entity)
|
if (gameObject is Entity)
|
||||||
{
|
{
|
||||||
gameObject.id = currentEntityId;
|
gameObject.id = currentEntityId;
|
||||||
|
@ -192,5 +193,10 @@ namespace DangerousD.GameCore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Player GetClosestPlayer(Vector2 position)
|
||||||
|
{
|
||||||
|
return players.OrderBy(x => (x.Pos - position).Length()).First();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -68,7 +68,7 @@ namespace DangerousD.GameCore.Managers
|
||||||
{
|
{
|
||||||
if (tiles[i] != 0)
|
if (tiles[i] != 0)
|
||||||
{
|
{
|
||||||
Vector2 pos = new(((chunkX+ i % chunkW) * tileSize.X + offsetX) * _scale,
|
Vector2 pos = new(((chunkX+ i % chunkW) * tileSize.X + offsetX) * _scale + 400,
|
||||||
((chunkY + i / chunkW) * tileSize.Y + offsetY) * _scale);
|
((chunkY + i / chunkW) * tileSize.Y + offsetY) * _scale);
|
||||||
//pos *= _scale;
|
//pos *= _scale;
|
||||||
Rectangle sourceRect = new(new Point((tiles[i] -1) % _columns, (tiles[i] -1) / _columns) * tileSize.ToPoint(), tileSize.ToPoint());
|
Rectangle sourceRect = new(new Point((tiles[i] -1) % _columns, (tiles[i] -1) / _columns) * tileSize.ToPoint(), tileSize.ToPoint());
|
||||||
|
|
|
@ -135,7 +135,6 @@ namespace DangerousD.GameCore.Managers
|
||||||
player.isOnGround = true;
|
player.isOnGround = true;
|
||||||
player.velocity.Y = 0;
|
player.velocity.Y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.SetPosition(new Vector2(newRect.X, newRect.Y));
|
player.SetPosition(new Vector2(newRect.X, newRect.Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue