Merge branch 'particlesBranch'
This commit is contained in:
commit
c05d13a68b
10 changed files with 119 additions and 49 deletions
|
@ -248,6 +248,18 @@
|
||||||
/processorParam:Quality=Best
|
/processorParam:Quality=Best
|
||||||
/build:sounds/shotgun_shot.mp3
|
/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
|
#begin textboxbackground1-1.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
|
BIN
DangerousD/Content/SmokeAnimation2.png
Normal file
BIN
DangerousD/Content/SmokeAnimation2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
1
DangerousD/Content/animations/smokeAfterShoot
Normal file
1
DangerousD/Content/animations/smokeAfterShoot
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"id":"smokeAfterShoot","textureName":"smokeAnimation2","startSpriteRectangle":{"X":0,"Y":0,"Width":64,"Height":64},"frameSecond":[{"Item1":0,"Item2":3}],"textureFrameInterval":1,"framesCount":10,"isCycle":false,"offset":"0, 0"}
|
BIN
DangerousD/Content/smokeAnimation.png
Normal file
BIN
DangerousD/Content/smokeAnimation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
|
@ -39,6 +39,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
isGoRight = false;
|
isGoRight = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.GraphicsComponent.actionOfAnimationEnd += (a) =>
|
||||||
|
{
|
||||||
|
if (a == "ZombieRightAttack" || a == "ZombieLeftAttack")
|
||||||
|
{
|
||||||
|
isAttaking = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveLeft");
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "ZombieMoveRight", "ZombieMoveLeft", "ZombieRightAttack", "ZombieLeftAttack" }, "ZombieMoveLeft");
|
||||||
|
|
||||||
|
@ -90,19 +98,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
{
|
{
|
||||||
if (isGoRight)
|
if (isGoRight)
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")
|
StartCicycleAnimation("ZombieMoveRight");
|
||||||
{
|
|
||||||
GraphicsComponent.StartAnimation("ZombieMoveRight");
|
|
||||||
}
|
|
||||||
velocity.X = monster_speed;
|
velocity.X = monster_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!isGoRight)
|
else if (!isGoRight)
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveLeft")
|
StartCicycleAnimation("ZombieMoveLeft");
|
||||||
{
|
|
||||||
GraphicsComponent.StartAnimation("ZombieMoveLeft");
|
|
||||||
}
|
|
||||||
velocity.X = -monster_speed;
|
velocity.X = -monster_speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,14 +138,14 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
if(isGoRight && this._pos.X <= AppManager.Instance.GameManager.players[0].Pos.X)
|
if(isGoRight && this._pos.X <= AppManager.Instance.GameManager.players[0].Pos.X)
|
||||||
{
|
{
|
||||||
isTarget = true;
|
isTarget = true;
|
||||||
leftBorder = Pos.X - 10;
|
leftBorder = Pos.X - 100;
|
||||||
rightBorder = Pos.X + AppManager.Instance.GameManager.players[0].Pos.X;
|
rightBorder = Pos.X + AppManager.Instance.GameManager.players[0].Pos.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(!isGoRight && this._pos.X >= AppManager.Instance.GameManager.players[0].Pos.X)
|
else if(!isGoRight && this._pos.X >= AppManager.Instance.GameManager.players[0].Pos.X)
|
||||||
{
|
{
|
||||||
isTarget = true;
|
isTarget = true;
|
||||||
rightBorder = Pos.X + 10;
|
rightBorder = Pos.X + 100;
|
||||||
leftBorder = AppManager.Instance.GameManager.players[0].Pos.X;
|
leftBorder = AppManager.Instance.GameManager.players[0].Pos.X;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,6 +161,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
||||||
rightBorder = 760;
|
rightBorder = 760;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void SwitchToRight()
|
||||||
|
{
|
||||||
|
isGoRight = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SwitchToLeft()
|
||||||
|
{
|
||||||
|
isGoRight = false;
|
||||||
|
}
|
||||||
public override void Attack(GameTime gameTime)
|
public override void Attack(GameTime gameTime)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,9 @@ using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace DangerousD.GameCore.GameObjects.PlayerDeath
|
namespace DangerousD.GameCore.GameObjects.PlayerDeath
|
||||||
{
|
{
|
||||||
public class DeathRectangle : GameObject
|
public class AnimationRectangle : GameObject
|
||||||
{
|
{
|
||||||
public DeathRectangle(Vector2 pos, string DeathType) : base(pos)
|
public AnimationRectangle(Vector2 pos, string DeathType) : base(pos)
|
||||||
{
|
{
|
||||||
Height = 48;
|
Height = 48;
|
||||||
Width = 48;
|
Width = 48;
|
|
@ -16,11 +16,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public class Player : LivingEntity
|
public class Player : LivingEntity
|
||||||
{
|
{
|
||||||
bool isAlive = true;
|
bool isAlive = true;
|
||||||
bool isRight;
|
bool isRight = true;
|
||||||
string stayAnimation;
|
string stayAnimation;
|
||||||
bool isJump = false;
|
bool isJump = false;
|
||||||
public int health;
|
public int health;
|
||||||
public bool isGoRight = false;
|
|
||||||
public Vector2 playerVelocity;
|
public Vector2 playerVelocity;
|
||||||
public int rightBorder;
|
public int rightBorder;
|
||||||
public int leftBorder;
|
public int leftBorder;
|
||||||
|
@ -32,6 +31,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public bool FallingThroughPlatform = false;
|
public bool FallingThroughPlatform = false;
|
||||||
public bool isUping = false;
|
public bool isUping = false;
|
||||||
public bool isNetworkPlayer;
|
public bool isNetworkPlayer;
|
||||||
|
private int shootLength = 160;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ 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"}, "playerReload");
|
"playerJumpRight" , "playerJumpLeft", "playerShootLeft", "playerShootRight", "playerReload", "smokeAfterShoot"}, "playerReload");
|
||||||
|
|
||||||
public void Attack()
|
public void Attack()
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
isAttacked = true;
|
isAttacked = true;
|
||||||
if(monsterName == "Zombie")
|
if(monsterName == "Zombie")
|
||||||
{
|
{
|
||||||
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
|
AnimationRectangle deathRectangle = new AnimationRectangle(Pos, "DeathFrom" + monsterName);
|
||||||
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
|
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
|
||||||
{
|
{
|
||||||
if (a == "DeathFrom" + monsterName)
|
if (a == "DeathFrom" + monsterName)
|
||||||
|
@ -114,7 +114,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
else if(monsterName == "Spider")
|
else if(monsterName == "Spider")
|
||||||
{
|
{
|
||||||
DeathRectangle deathRectangle = new DeathRectangle(Pos, "DeathFrom" + monsterName);
|
AnimationRectangle deathRectangle = new AnimationRectangle(Pos, "DeathFrom" + monsterName);
|
||||||
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
|
deathRectangle.Gr.actionOfAnimationEnd += (a) =>
|
||||||
{
|
{
|
||||||
if (a == "DeathFrom" + monsterName)
|
if (a == "DeathFrom" + monsterName)
|
||||||
|
@ -136,35 +136,28 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
public void Shoot()
|
public void Shoot()
|
||||||
{
|
{
|
||||||
if (bullets > 0)
|
if (bullets > 0)
|
||||||
|
{
|
||||||
|
if (!isAttacked)
|
||||||
{
|
{
|
||||||
if (!isShooting)
|
if (!isShooting)
|
||||||
{
|
{
|
||||||
AppManager.Instance.SoundManager.StartSound("shotgun_shot", Pos, Pos);
|
|
||||||
isShooting = true;
|
isShooting = true;
|
||||||
bullets--;
|
bullets--;
|
||||||
if (isRight)
|
if (isRight)
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "playerShootRight")
|
StartCicycleAnimation("playerShootRight");
|
||||||
{
|
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());
|
||||||
GraphicsComponent.StartAnimation("playerShootRight");
|
|
||||||
}
|
|
||||||
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)(Pos.Y - 10f), 100, 10), typeof(Zombie));
|
|
||||||
if (targets != null)
|
if (targets != null)
|
||||||
{
|
{
|
||||||
foreach (var target in targets)
|
Zombie targetZombie = (Zombie)targets.First();
|
||||||
{
|
|
||||||
Zombie targetZombie = (Zombie)target;
|
|
||||||
targetZombie.TakeDamage();
|
targetZombie.TakeDamage();
|
||||||
}
|
}
|
||||||
}
|
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "playerShootRight")
|
StartCicycleAnimation("playerShootLeft");
|
||||||
{
|
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - shootLength, (int)(Pos.Y - 10f), shootLength, 10), typeof(Zombie));
|
||||||
GraphicsComponent.StartAnimation("playerShootRight");
|
|
||||||
}
|
|
||||||
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)(Pos.Y - 10f), -100, 10), typeof(Zombie));
|
|
||||||
if (targets != null)
|
if (targets != null)
|
||||||
{
|
{
|
||||||
foreach (var target in targets)
|
foreach (var target in targets)
|
||||||
|
@ -173,13 +166,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
targetZombie.TakeDamage();
|
targetZombie.TakeDamage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
if (AppManager.Instance.InputManager.ScopeState==ScopeState.Up)
|
if (AppManager.Instance.InputManager.ScopeState == ScopeState.Up)
|
||||||
{
|
{
|
||||||
isUping = true;
|
isUping = true;
|
||||||
}
|
}
|
||||||
|
@ -193,6 +188,8 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
GraphicsComponent.SetCameraPosition(Pos);
|
GraphicsComponent.SetCameraPosition(Pos);
|
||||||
if (!isAttacked || AppManager.Instance.InputManager.InvincibilityCheat)
|
if (!isAttacked || AppManager.Instance.InputManager.InvincibilityCheat)
|
||||||
|
{
|
||||||
|
if (!isShooting)
|
||||||
{
|
{
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
}
|
}
|
||||||
|
@ -200,6 +197,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
velocity.X = 0;
|
velocity.X = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
velocity.X = 0;
|
||||||
|
}
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using DangerousD.GameCore.GameObjects;
|
||||||
|
using DangerousD.GameCore.Graphics;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
|
namespace DangerousD.GameCore.GameObjects.PlayerDeath
|
||||||
|
{
|
||||||
|
public class SmokeAfterShoot : GameObject
|
||||||
|
{
|
||||||
|
public SmokeAfterShoot(Vector2 pos) : base(pos)
|
||||||
|
{
|
||||||
|
Height = 6;
|
||||||
|
Width = 6;
|
||||||
|
PlaySmoke();
|
||||||
|
this.GraphicsComponent.actionOfAnimationEnd += (a) =>
|
||||||
|
{
|
||||||
|
if (a == "smokeAfterShoot")
|
||||||
|
{
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override GraphicsComponent GraphicsComponent { get; } = new(new List<string> { "smokeAfterShoot" },
|
||||||
|
"smokeAfterShoot");
|
||||||
|
|
||||||
|
public GraphicsComponent Gr => GraphicsComponent;
|
||||||
|
|
||||||
|
private void PlaySmoke()
|
||||||
|
{
|
||||||
|
if (GraphicsComponent.GetCurrentAnimation != "smokeAfterShoot")
|
||||||
|
{
|
||||||
|
GraphicsComponent.StartAnimation("smokeAfterShoot");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -164,9 +164,10 @@ namespace DangerousD.GameCore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetPlayer1.Update(gameTime);
|
GetPlayer1.Update(gameTime);
|
||||||
|
for(int i = 0; i < otherObjects.Count; i++)
|
||||||
foreach (var item in otherObjects)
|
{
|
||||||
item.Update(gameTime);
|
otherObjects[i].Update(gameTime);
|
||||||
|
}
|
||||||
|
|
||||||
physicsManager.UpdateCollisions(entities, livingEntities, mapObjects, players, gameTime);
|
physicsManager.UpdateCollisions(entities, livingEntities, mapObjects, players, gameTime);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue