More weapon and movement updates
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -11,8 +11,9 @@ namespace EvilSatellites.Objects
|
|||||||
public class Player : AbstractGameObject
|
public class Player : AbstractGameObject
|
||||||
{
|
{
|
||||||
private Vector3 _PrevPos;
|
private Vector3 _PrevPos;
|
||||||
private Vector3 MaxSpeed = new Vector3(1, 1, 1);
|
private Vector3 MaxSpeed = new Vector3(0.2f, 0.2f, 0.2f);
|
||||||
private Vector3 Deceleration = new Vector3(0.005f, 0.005f, 0.005f);
|
public Vector3 Acceleration = new Vector3(0.008f, 0.008f, 0.008f);
|
||||||
|
private Vector3 Deceleration = new Vector3(0.0025f, 0.0025f, 0.0025f);
|
||||||
private ISoundEffect sfxEngine;
|
private ISoundEffect sfxEngine;
|
||||||
private ISoundEffect sfxWhine;
|
private ISoundEffect sfxWhine;
|
||||||
public IWeapon CurrentWeapon;
|
public IWeapon CurrentWeapon;
|
||||||
@@ -21,7 +22,7 @@ namespace EvilSatellites.Objects
|
|||||||
ShouldDestroy = false;
|
ShouldDestroy = false;
|
||||||
Active = true;
|
Active = true;
|
||||||
Type = ObjectType.Player;
|
Type = ObjectType.Player;
|
||||||
Position = new Vector3(10, 0, 0);
|
Position = new Vector3(0, 0, 0);
|
||||||
Dimensions = new Vector3(5, 5, 5);
|
Dimensions = new Vector3(5, 5, 5);
|
||||||
Movement = new Vector3(0, 0, 0);
|
Movement = new Vector3(0, 0, 0);
|
||||||
Rotation = Matrix.Identity;
|
Rotation = Matrix.Identity;
|
||||||
|
|||||||
@@ -12,15 +12,17 @@ namespace EvilSatellites.Objects
|
|||||||
public class Projectile : AbstractGameObject
|
public class Projectile : AbstractGameObject
|
||||||
{
|
{
|
||||||
private ISoundEffect3D Sound;
|
private ISoundEffect3D Sound;
|
||||||
|
private Random rnd = new Random();
|
||||||
private Vector3 Direction;
|
private Vector3 Direction;
|
||||||
private Vector3 StartPos;
|
private Vector3 StartPos;
|
||||||
private float Range;
|
private float Range;
|
||||||
public Projectile(IScreen screen, Vector3 pos, Vector3 direction) : base(screen)
|
public Projectile(IScreen screen, Vector3 pos, Matrix rotation) : base(screen)
|
||||||
{
|
{
|
||||||
StartPos = pos;
|
StartPos = pos;
|
||||||
Position = pos;
|
Position = pos;
|
||||||
Dimensions = new Vector3(5, 5, 5);
|
Dimensions = new Vector3(5, 5, 5);
|
||||||
Direction = direction;
|
Direction = new Vector3(0, 0, -1);
|
||||||
|
Rotation = rotation;
|
||||||
Range = 500;
|
Range = 500;
|
||||||
Type = ObjectType.Projectile;
|
Type = ObjectType.Projectile;
|
||||||
Activate();
|
Activate();
|
||||||
@@ -39,7 +41,7 @@ namespace EvilSatellites.Objects
|
|||||||
|
|
||||||
override public void Update(GameTime gameTime)
|
override public void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
Position += Direction;
|
Move(Direction);
|
||||||
if (Vector3.Distance(StartPos, Position) > Range)
|
if (Vector3.Distance(StartPos, Position) > Range)
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
@@ -48,8 +50,9 @@ namespace EvilSatellites.Objects
|
|||||||
|
|
||||||
public override void OnCollision(IGameObject obj)
|
public override void OnCollision(IGameObject obj)
|
||||||
{
|
{
|
||||||
|
if (obj.Type == ObjectType.Projectile) return;
|
||||||
if (obj.Type == ObjectType.Player) return;
|
if (obj.Type == ObjectType.Player) return;
|
||||||
Screen.Manager.Sound.PlayOneshot(@"sfx/physics/impacts/bullet/1.wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z), Screen.Manager.EnvironmentEffect);
|
Screen.Manager.Sound.PlayOneshot(@"sfx/physics/impacts/bullet/"+(rnd.Next(5)+1)+".wav", new System.Numerics.Vector3(Position.X, Position.Y, Position.Z), Screen.Manager.EnvironmentEffect);
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace EvilSatellites
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
|
||||||
DavyKager.Tolk.Load();
|
DavyKager.Tolk.Load();
|
||||||
using (var game = new Game1())
|
using (var game = new Game1())
|
||||||
game.Run();
|
game.Run();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Text;
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using SynthySound;
|
using SynthySound;
|
||||||
|
using Synthizer;
|
||||||
using Microsoft.Xna.Framework.Audio;
|
using Microsoft.Xna.Framework.Audio;
|
||||||
using EvilSatellites.Screens;
|
using EvilSatellites.Screens;
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ namespace EvilSatellites
|
|||||||
private Game _Game;
|
private Game _Game;
|
||||||
private bool _Running = false;
|
private bool _Running = false;
|
||||||
public Synthy Sound = new Synthy();
|
public Synthy Sound = new Synthy();
|
||||||
|
|
||||||
public FDNReverb EnvironmentEffect;
|
public FDNReverb EnvironmentEffect;
|
||||||
public AudioListener Listener = new AudioListener();
|
public AudioListener Listener = new AudioListener();
|
||||||
public ScreenManager(Game instance): base(instance)
|
public ScreenManager(Game instance): base(instance)
|
||||||
|
|||||||
@@ -94,19 +94,19 @@ namespace EvilSatellites.Screens
|
|||||||
Vector3 move = new Vector3(0, 0, 0);
|
Vector3 move = new Vector3(0, 0, 0);
|
||||||
if (Input.IsPressed(Keys.W))
|
if (Input.IsPressed(Keys.W))
|
||||||
{
|
{
|
||||||
move.Z = -0.035f;
|
move.Z = -_player.Acceleration.Z;
|
||||||
}
|
}
|
||||||
if (Input.IsPressed(Keys.S))
|
if (Input.IsPressed(Keys.S))
|
||||||
{
|
{
|
||||||
move.Z = 0.035f;
|
move.Z = _player.Acceleration.Z;
|
||||||
}
|
}
|
||||||
if (Input.IsPressed(Keys.A))
|
if (Input.IsPressed(Keys.A))
|
||||||
{
|
{
|
||||||
move.X = -0.035f;
|
move.X = -_player.Acceleration.X;
|
||||||
}
|
}
|
||||||
if (Input.IsPressed(Keys.D))
|
if (Input.IsPressed(Keys.D))
|
||||||
{
|
{
|
||||||
move.X = 0.035f;
|
move.X = _player.Acceleration.X;
|
||||||
}
|
}
|
||||||
if (Input.IsPressed(Keys.Left))
|
if (Input.IsPressed(Keys.Left))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace EvilSatellites.Weapons
|
|||||||
{
|
{
|
||||||
sfxShoot.Play();
|
sfxShoot.Play();
|
||||||
TimerStart = TimerEnd;
|
TimerStart = TimerEnd;
|
||||||
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation.Forward);
|
Projectile proj = new Projectile(Screen, _wielder.Position, _wielder.Rotation);
|
||||||
Screen.AddObject(proj);
|
Screen.AddObject(proj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user