- Timestamp:
- 2011-06-30 14:20:00 (12 years ago)
- Location:
- 2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Enemies.cs
r2355 r2361 8 8 public class MeleeAlien : GenCharacter 9 9 { 10 const int speed = 100; 11 const int mass = 15; 10 12 Image portrait = Game.LoadImage("Images/basealien"); 13 FollowerBrain brain; 11 14 12 public MeleeAlien(double width, double height, Shape shape, int HP )13 : base(width, height, shape, HP )15 public MeleeAlien(double width, double height, Shape shape, int HP, PhysicsObject target) 16 : base(width, height, shape, HP, target) 14 17 { 15 18 this.Image = portrait; 16 19 this.Tag = "MeleeAlien"; 20 this.Mass = mass; 21 22 brain = new FollowerBrain(); 23 this.Brain = brain; 24 brain.Target = target; 25 brain.Speed = speed; 26 brain.FollowAlways = true; 27 //brain.StopWhenTargetClose = true; 28 brain.TargetCloseDistance = 20; 17 29 } 30 31 private void closeToTarget(FollowerBrain senderBrain, EventArgs e) 32 { 33 senderBrain.Speed += 500; 34 } 35 36 public override void deathOccurred() 37 { 38 /*Explosion explosion = new Explosion(1000); 39 explosion.Position = this.Position; 40 Add(explosion);*/ 41 this.Destroy(); 42 } 18 43 } -
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/GenCharacter.cs
r2355 r2361 21 21 22 22 // The constructor that just relays the variables forward 23 public GenCharacter(double width, double height, Shape shape, int HP )23 public GenCharacter(double width, double height, Shape shape, int HP, PhysicsObject target = null) 24 24 : base(width, height, shape) 25 25 { … … 44 44 45 45 // A method for handling death, i.e., removing the player, saving scores or whatever 46 p rivatevoid deathOccurred()46 public virtual void deathOccurred() 47 47 { 48 /*Explosion explosion = new Explosion(100); 49 explosion.Position = this.Position; 50 Add(explosion);*/ 48 51 this.Destroy(); 49 52 } -
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Peli.cs
r2360 r2361 14 14 Player player; 15 15 Image background1 = LoadImage("Images/reactorBG"); 16 17 16 18 17 public override void Begin() … … 106 105 MeleeAlien addMeleeAlien() 107 106 { 108 MeleeAlien meleeAlien = new MeleeAlien(45, 80, Shape.Rectangle, 50 );107 MeleeAlien meleeAlien = new MeleeAlien(45, 80, Shape.Rectangle, 50, player); 109 108 return meleeAlien; 110 109 } -
2011/26/JaakkoL/Rogue Agent 2372/Rogue Agent 2372/Rogue Agent 2372/Player.cs
r2356 r2361 9 9 { 10 10 const int speed = 200; 11 const int jumpSpeed = 500;11 const int jumpSpeed = 200; 12 12 const int mass = 10; 13 13 Image portrait = Game.LoadImage("Images/character"); 14 14 SoundEffect walking = Game.LoadSoundEffect("Sounds/walkingsound"); 15 16 Pistol pistol; 17 // Rifle rifle; 15 18 16 19 Timer walker; … … 23 26 this.Image = portrait; 24 27 this.CollisionIgnoreGroup = 1; 28 this.Mass = mass; 25 29 26 30 // Creating the timer system that is *supposed* to enable a nice walking sound effect … … 30 34 31 35 // Creating the weapon; for now only a pistol 32 Pistolpistol = new Pistol(20.0, 10.0);36 pistol = new Pistol(20.0, 10.0); 33 37 pistol.X = 18; 34 38 pistol.Y = 11; 35 this.Weapon = pistol; 39 this.Weapon = pistol; // The default weapon 36 40 pistol.ProjectileCollision += bulletReachedTarget; 37 41 42 /* 43 rifle = new Rifle(20.0, 10.0); 44 rifle.X = 18; 45 rifle.Y = 11; 46 rifle.ProjectileCollision += bulletReachedTarget; 47 */ 38 48 // Collision handlers for enemies 39 49 //AddCollisionHandler(); … … 48 58 } 49 59 60 // Because all the weapons have infinite ammo, we don't have to check for null 50 61 private void shoot() 51 62 { 52 63 PhysicsObject bullet = this.Weapon.Shoot(); 53 54 // As of now weapons are set to have infinite ammo, but that might change55 if (bullet != null)56 {57 58 }59 64 } 60 65 … … 94 99 this.Jump(jumpSpeed); 95 100 } 96 97 101 }
Note: See TracChangeset
for help on using the changeset viewer.