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 (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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,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)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
|
@ -134,43 +134,37 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
if (bullets > 0)
|
if (bullets > 0)
|
||||||
{
|
{
|
||||||
if (!isShooting)
|
if (!isAttacked)
|
||||||
{
|
{
|
||||||
isShooting = true;
|
if (!isShooting)
|
||||||
bullets--;
|
|
||||||
if (isRight)
|
|
||||||
{
|
{
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "playerShootRight")
|
isShooting = true;
|
||||||
|
bullets--;
|
||||||
|
if (isRight)
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("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());
|
||||||
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X, (int)(Pos.Y - 10f), shootLength + 24, 10), typeof(Zombie));
|
if (targets != null)
|
||||||
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));
|
||||||
}
|
}
|
||||||
SmokeAfterShoot smokeAfterShoot = new SmokeAfterShoot(new Vector2(Pos.X + 30, Pos.Y + 7));
|
else
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (GraphicsComponent.GetCurrentAnimation != "playerShootLeft")
|
|
||||||
{
|
{
|
||||||
GraphicsComponent.StartAnimation("playerShootLeft");
|
StartCicycleAnimation("playerShootLeft");
|
||||||
}
|
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - shootLength, (int)(Pos.Y - 10f), shootLength, 10), typeof(Zombie));
|
||||||
var targets = AppManager.Instance.GameManager.physicsManager.CheckRectangle(new Rectangle((int)Pos.X - shootLength, (int)(Pos.Y - 10f), shootLength, 10), typeof(Zombie));
|
if (targets != null)
|
||||||
if (targets != null)
|
|
||||||
{
|
|
||||||
foreach (var target in targets)
|
|
||||||
{
|
{
|
||||||
Zombie targetZombie = (Zombie)target;
|
foreach (var target in targets)
|
||||||
targetZombie.TakeDamage();
|
{
|
||||||
|
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;
|
FallingThroughPlatform = false;
|
||||||
}
|
}
|
||||||
GraphicsComponent.SetCameraPosition(Pos);
|
GraphicsComponent.SetCameraPosition(Pos);
|
||||||
if (!isAttacked || AppManager.Instance.InputManager.InvincibilityCheat)
|
if (!isAttacked || AppManager.Instance.InputManager.InvincibilityCheat)
|
||||||
{
|
{
|
||||||
if (!isShooting)
|
if (!isShooting)
|
||||||
{
|
{
|
||||||
|
@ -201,6 +195,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
velocity.X = 0;
|
velocity.X = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
velocity.X = 0;
|
||||||
|
}
|
||||||
|
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue