WIP
This commit is contained in:
parent
f2a6cdbd8d
commit
03e6f7b75d
10 changed files with 49 additions and 11 deletions
|
@ -13,6 +13,18 @@
|
|||
|
||||
#---------------------------------- Content ---------------------------------#
|
||||
|
||||
#begin animation1.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:animation1.png
|
||||
|
||||
#begin File.spritefont
|
||||
/importer:FontDescriptionImporter
|
||||
/processor:FontDescriptionProcessor
|
||||
|
|
BIN
DangerousD/Content/animation1.png
Normal file
BIN
DangerousD/Content/animation1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
1
DangerousD/Content/animations/ZombieMoveLeft
Normal file
1
DangerousD/Content/animations/ZombieMoveLeft
Normal file
|
@ -0,0 +1 @@
|
|||
{"id":"ZombieMoveLeft","textureName":"animation1","startSpriteRectangle":{"X":1,"Y":50,"Width":24,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":4,"isCycle":true}
|
|
@ -1 +1 @@
|
|||
{"id":"ZombieMoveRight","textureName":"animation1","startSpriteRectangle":{"X":1,"Y":9,"Width":24,"Height":40},"frameSecond":[{"Item1":0,"Item2":8}],"textureFrameInterval":1,"framesCount":4,"isCycle":true}
|
||||
{"id":"ZombieMoveRight","textureName":"animation1","startSpriteRectangle":{"X":1,"Y":9,"Width":24,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":4,"isCycle":true}
|
||||
|
|
1
DangerousD/Content/animations/ZombieRightAttack
Normal file
1
DangerousD/Content/animations/ZombieRightAttack
Normal file
|
@ -0,0 +1 @@
|
|||
{"id":"ZombieRightAttack","textureName":"animation1","startSpriteRectangle":{"X":126,"Y":6,"Width":50,"Height":40},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":3,"isCycle":false}
|
|
@ -16,6 +16,8 @@ namespace DangerousD.GameCore
|
|||
public int Width { get; protected set; }
|
||||
public int Height { get; protected set; }
|
||||
public Rectangle Rectangle => new Rectangle((int)Pos.X, (int)Pos.Y, Width, Height);
|
||||
public Vector2 velocity;
|
||||
public Vector2 acceleration;
|
||||
protected abstract GraphicsComponent GraphicsComponent { get; }
|
||||
public GameObject(Vector2 pos)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
|
||||
public abstract void Attack();
|
||||
|
||||
public abstract void Move();
|
||||
public abstract void Move(GameTime gameTime);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,36 +12,59 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
{
|
||||
public class Zombie : CoreEnemy
|
||||
{
|
||||
private bool isGoRight = true;
|
||||
public Zombie(Vector2 position) : base(position)
|
||||
{
|
||||
Width = 24;
|
||||
Height = 40;
|
||||
GraphicsComponent.StartAnimation("ZombieMoveRight");
|
||||
Width = 72;
|
||||
Height = 120;
|
||||
GraphicsComponent.StartAnimation("ZombieRightAttack");
|
||||
monster_speed = 100;
|
||||
}
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight"}, "ZombieMoveRight");
|
||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack"}, "ZombieMoveRight");
|
||||
|
||||
public override void Update(GameTime gameTime)
|
||||
{
|
||||
Move();
|
||||
//Move(gameTime);
|
||||
if (monster_health <= 0)
|
||||
{
|
||||
isAlive = false;
|
||||
Death();
|
||||
}
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
||||
public override void Attack()
|
||||
{
|
||||
if (isGoRight)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override void Death()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Move()
|
||||
public override void Move(GameTime gameTime)
|
||||
{
|
||||
if (isGoRight)
|
||||
{
|
||||
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")
|
||||
{
|
||||
GraphicsComponent.StartAnimation("ZombieMoveRight");
|
||||
velocity = new Vector2(monster_speed, 0);
|
||||
}
|
||||
}
|
||||
|
||||
else if (!isGoRight)
|
||||
{
|
||||
if(GraphicsComponent.GetCurrentAnimation != "ZombieMoveLeft")
|
||||
{
|
||||
GraphicsComponent.StartAnimation("ZombieMoveLeft");
|
||||
velocity = new Vector2(-monster_speed, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
{
|
||||
public class Player : LivingEntity
|
||||
{
|
||||
public Player(Vector2 position): base(position)
|
||||
public Player(Vector2 position) : base(position)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override GraphicsComponent GraphicsComponent => throw new NotImplementedException();
|
||||
|
||||
public void Kill()
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace DangerousD.GameCore.Levels
|
|||
{
|
||||
public void InitLevel()
|
||||
{
|
||||
//new Player();
|
||||
var Трава = new GrassBlock(new Vector2(0, 128));
|
||||
var Death = new TestAnimationDeath(new Vector2(128, 128));
|
||||
var Zombie = new Zombie(new Vector2(256, 128));
|
||||
|
|
Loading…
Add table
Reference in a new issue