fixed some bags
This commit is contained in:
parent
b30a8515d2
commit
5db6cee0fa
4 changed files with 84 additions and 37 deletions
|
@ -1 +1,24 @@
|
|||
{"id":"playerShootLeft","textureName":"playerAnimation","startSpriteRectangle":{"X":201,"Y":34,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":2,"isCycle":false,"offset":"4, 0"}
|
||||
{
|
||||
"id": "playerShootLeft",
|
||||
"textureName": "playerAnimation",
|
||||
"startSpriteRectangle": {
|
||||
"X": 201,
|
||||
"Y": 34,
|
||||
"Width": 32,
|
||||
"Height": 32
|
||||
},
|
||||
"frameSecond": [
|
||||
{
|
||||
"Item1": 0,
|
||||
"Item2": 3
|
||||
},
|
||||
{
|
||||
"Item1": 1,
|
||||
"Item2": 20
|
||||
}
|
||||
],
|
||||
"textureFrameInterval": 1,
|
||||
"framesCount": 2,
|
||||
"isCycle": false,
|
||||
"offset": "4, 0"
|
||||
}
|
||||
|
|
|
@ -1 +1,24 @@
|
|||
{"id":"playerShootRight","textureName":"playerAnimation","startSpriteRectangle":{"X":201,"Y":1,"Width":32,"Height":32},"frameSecond":[{"Item1":0,"Item2":12}],"textureFrameInterval":1,"framesCount":2,"isCycle":false,"offset":"4, 0"}
|
||||
{
|
||||
"id": "playerShootRight",
|
||||
"textureName": "playerAnimation",
|
||||
"startSpriteRectangle": {
|
||||
"X": 201,
|
||||
"Y": 1,
|
||||
"Width": 32,
|
||||
"Height": 32
|
||||
},
|
||||
"frameSecond": [
|
||||
{
|
||||
"Item1": 0,
|
||||
"Item2": 3
|
||||
},
|
||||
{
|
||||
"Item1": 1,
|
||||
"Item2": 20
|
||||
}
|
||||
],
|
||||
"textureFrameInterval": 1,
|
||||
"framesCount": 2,
|
||||
"isCycle": false,
|
||||
"offset": "4, 0"
|
||||
}
|
||||
|
|
|
@ -98,19 +98,13 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
{
|
||||
if (isGoRight)
|
||||
{
|
||||
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveRight")
|
||||
{
|
||||
GraphicsComponent.StartAnimation("ZombieMoveRight");
|
||||
}
|
||||
StartCicycleAnimation("ZombieMoveRight");
|
||||
velocity.X = monster_speed;
|
||||
}
|
||||
|
||||
else if (!isGoRight)
|
||||
{
|
||||
if (GraphicsComponent.GetCurrentAnimation != "ZombieMoveLeft")
|
||||
{
|
||||
GraphicsComponent.StartAnimation("ZombieMoveLeft");
|
||||
}
|
||||
StartCicycleAnimation("ZombieMoveLeft");
|
||||
velocity.X = -monster_speed;
|
||||
}
|
||||
|
||||
|
@ -167,6 +161,15 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities.Monsters
|
|||
rightBorder = 760;
|
||||
}
|
||||
}
|
||||
public void SwitchToRight()
|
||||
{
|
||||
isGoRight = true;
|
||||
}
|
||||
|
||||
public void SwitchToLeft()
|
||||
{
|
||||
isGoRight = false;
|
||||
}
|
||||
public override void Attack(GameTime gameTime)
|
||||
{}
|
||||
|
||||
|
|
|
@ -134,43 +134,37 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
{
|
||||
if (bullets > 0)
|
||||
{
|
||||
if (!isShooting)
|
||||
if (!isAttacked)
|
||||
{
|
||||
isShooting = true;
|
||||
bullets--;
|
||||
if (isRight)
|
||||
if (!isShooting)
|
||||
{
|
||||
if (GraphicsComponent.GetCurrentAnimation != "playerShootRight")
|
||||
isShooting = true;
|
||||
bullets--;
|
||||
if (isRight)
|
||||
{
|
||||
GraphicsComponent.StartAnimation("playerShootRight");
|
||||
}
|
||||
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)(Pos.Y - 10f), shootLength + 24, 10), typeof(Zombie));
|
||||
if (targets != null)
|
||||
{
|
||||
foreach (var target in targets)
|
||||
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());
|
||||
if (targets != null)
|
||||
{
|
||||
Zombie targetZombie = (Zombie)target;
|
||||
Zombie targetZombie = (Zombie)targets.First();
|
||||
targetZombie.TakeDamage();
|
||||
}
|
||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
||||
}
|
||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GraphicsComponent.GetCurrentAnimation != "playerShootLeft")
|
||||
else
|
||||
{
|
||||
GraphicsComponent.StartAnimation("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)
|
||||
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)
|
||||
{
|
||||
Zombie targetZombie = (Zombie)target;
|
||||
targetZombie.TakeDamage();
|
||||
foreach (var target in targets)
|
||||
{
|
||||
Zombie targetZombie = (Zombie)target;
|
||||
targetZombie.TakeDamage();
|
||||
}
|
||||
}
|
||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7));
|
||||
}
|
||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X - 12, Pos.Y + 7));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -190,7 +184,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
FallingThroughPlatform = false;
|
||||
}
|
||||
GraphicsComponent.SetCameraPosition(Pos);
|
||||
if (!isAttacked || AppManager.Instance.InputManager.InvincibilityCheat)
|
||||
if (!isAttacked || AppManager.Instance.InputManager.InvincibilityCheat)
|
||||
{
|
||||
if (!isShooting)
|
||||
{
|
||||
|
@ -201,6 +195,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
|||
velocity.X = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
velocity.X = 0;
|
||||
}
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue