- Timestamp:
- 2016-06-09 09:08:18 (7 years ago)
- Location:
- 2016/23/ohjaajat/Punasininen/Punasininen
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Player.cs
r7210 r7211 13 13 public Vector Spawn; 14 14 15 public Player(double leveys, double korkeus, Image pic,Color color)15 public Player(double leveys, double korkeus, Color color) 16 16 : base(leveys, korkeus) 17 17 { 18 Image = pic;19 18 Color = color; 20 19 CanRotate = false; -
2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Punasininen.cs
r7210 r7211 23 23 private Image blueGlow = LoadImage("blueglow"); 24 24 25 private Image bluepic;26 private Image redpic;27 28 25 Color blueColor = Color.FromHexCode("FF1D65CF"); 29 26 Color redColor = Color.FromHexCode("FABE1A"); … … 38 35 public override void Begin() 39 36 { 40 41 IsMouseVisible = true; // <- voi ottaa pois42 37 shader = new Shader(GraphicsDevice, Content, Camera); 43 38 44 //Gravity = new Vector(0, -1000);45 39 CreateLevel(); 46 40 AddControls(); … … 63 57 ColorTileMap map = ColorTileMap.FromLevelAsset("dungeon1"); 64 58 map.SetTileMethod(Color.Black, AddPlatform); 65 map.SetTileMethod(Color.FromHexCode("#FF0026FF"), delegate(Vector paikka, double leveys, double korkeus) { blue = CreatePlayer(paikka, leveys, korkeus, blue pic, blueColor);});59 map.SetTileMethod(Color.FromHexCode("#FF0026FF"), delegate(Vector paikka, double leveys, double korkeus) { blue = CreatePlayer(paikka, leveys, korkeus, blueColor, blueWalkImages, bluePistolpic);}); 66 60 map.SetTileMethod(Color.FromHexCode("FFD800"), CreateWeaponCrate); 67 map.SetTileMethod(Color.Red, delegate(Vector paikka, double leveys, double korkeus) { red = CreatePlayer(paikka, leveys, korkeus, red pic, redColor); });61 map.SetTileMethod(Color.Red, delegate(Vector paikka, double leveys, double korkeus) { red = CreatePlayer(paikka, leveys, korkeus, redColor, orangeWalkImages, orangePistolpic); }); 68 62 map.Execute(TILE_SIZE, TILE_SIZE); 69 63 70 64 Surface bottom = Surface.CreateBottom(Level); 71 bottom.Width *= 2;65 bottom.Width *= 5; 72 66 bottom.Y -= Level.Height / 2; 73 67 bottom.Tag = "death"; 68 bottom.Color = Color.HanPurple; //terveisin 74 69 Add(bottom); 75 70 … … 103 98 } 104 99 105 Player CreatePlayer(Vector paikka, double leveys, double korkeus, Image playerspic, Color playersColor)106 { 107 Player player = new Player(leveys * 1 .1, korkeus * 1.5, playerspic, playersColor);108 player.AnimWalk = new Animation( blueWalkImages) { FPS = 30 };109 player.AnimIdle = new Animation(new[] { blueWalkImages[0] });110 player.Position = paikka ;111 player.Spawn = p aikka;100 Player CreatePlayer(Vector paikka, double leveys, double korkeus, Color playersColor, Image[] animation, Image pistolPic) 101 { 102 Player player = new Player(leveys * 1, korkeus * 1.5, playersColor); 103 player.AnimWalk = new Animation(animation) { FPS = 30 }; 104 player.AnimIdle = new Animation(new[] { animation[0] }); 105 player.Position = paikka + new Vector(0, korkeus/2); 106 player.Spawn = player.Position; 112 107 Add(player); 113 108 … … 118 113 MaxAmmoLifetime = TimeSpan.FromSeconds(8), 119 114 ProjectileCollision = BulletHitsSomething, 120 Image = bluePistolpic,115 Image = pistolPic, 121 116 Y = 5 122 117 }; … … 128 123 AddCollisionHandler(player, "crate", delegate(PhysicsObject a, PhysicsObject b) 129 124 { 130 //((Player)a).Weapon = ((WeaponCrate)b).GiveWeapon(); 131 player.Weapon = GunLottery(); 125 GunLottery(player); 132 126 b.Destroy(); 133 127 }); … … 162 156 } 163 157 164 Weapon GunLottery()165 { 166 return new AssaultRifle(TILE_SIZE / 2, TILE_SIZE / 2) { FireRate = 1.5, AttackSound = null, MaxAmmoLifetime = TimeSpan.FromSeconds(8), ProjectileCollision = BulletHitsSomething };158 void GunLottery(Player player) 159 { 160 player.Weapon = new ColorGun(player.Weapon.Width, player.Weapon.Height, player.Weapon.Image, player, this); 167 161 } 168 162 … … 183 177 } 184 178 185 void ColorTile(PhysicsObject player, PhysicsObject platform)179 public void ColorTile(PhysicsObject player, PhysicsObject platform) 186 180 { 187 181 var imgs = player.Color == blueColor? blueTileImages : orangeTileImages; … … 241 235 void Aim(AnalogState stickState, Player player) 242 236 { 243 237 player.Weapon.Angle = stickState.StateVector.Angle; 244 238 } 245 239 -
2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/WeaponCrate.cs
r7203 r7211 9 9 class WeaponCrate : PhysicsObject 10 10 { 11 12 11 public WeaponCrate(double leveys, double korkeus) 13 12 : base(leveys, korkeus) … … 15 14 Tag = "crate"; 16 15 } 16 } 17 17 18 /* 19 public Weapon GiveWeapon() 18 class ColorGun : Weapon 19 { 20 public Player Owner; 21 22 public Game MyGame; 23 24 protected override PhysicsObject CreateProjectile() 20 25 { 21 this.Destroy(); 22 }*/ 26 Grenade test = new Grenade(10, TimeSpan.FromSeconds(1)); 27 test.Explosion.ShockwaveColor = Owner.Color; 28 return test; 29 } 30 31 public ColorGun(double leveys, double korkeus, Image image, Player owner, Game game) 32 : base(leveys, korkeus) 33 { 34 Image = image; 35 AttackSound = null; 36 FireRate = 1; 37 Power.DefaultValue = 15000; 38 Owner = owner; 39 MyGame = game; 40 41 } 23 42 }
Note: See TracChangeset
for help on using the changeset viewer.