- Timestamp:
- 2016-06-08 11:34:27 (7 years ago)
- Location:
- 2016/23/ohjaajat/Punasininen/Punasininen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Player.cs
r7203 r7205 10 10 { 11 11 12 Weapon Secondary;12 public Weapon Secondary; 13 13 14 14 public Player(double leveys, double korkeus, Image pic, Color color) … … 21 21 Tag = "player"; 22 22 Acceleration = 5000; 23 23 24 24 25 } -
2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Punasininen.cs
r7204 r7205 57 57 58 58 ColorTileMap map = ColorTileMap.FromLevelAsset("dungeon1"); 59 map.SetTileMethod(Color.Black, LisaaTaso);59 map.SetTileMethod(Color.Black, AddPlatform); 60 60 map.SetTileMethod(Color.FromHexCode("#FF0026FF"), delegate(Vector paikka, double leveys, double korkeus) { blue = CreatePlayer(paikka, leveys, korkeus, bluepic, Color.Blue);}); 61 61 map.SetTileMethod(Color.FromHexCode("FFD800"), CreateWeaponCrate); … … 83 83 } 84 84 85 void LisaaTaso(Vector paikka, double leveys, double korkeus)85 void AddPlatform(Vector paikka, double leveys, double korkeus) 86 86 { 87 87 PhysicsObject platform = PhysicsObject.CreateStaticObject(leveys, korkeus); … … 98 98 Add(player); 99 99 100 player.Weapon = new AssaultRifle(leveys / 2, korkeus / 2) { FireRate = 1.5, AttackSound = null, MaxAmmoLifetime = TimeSpan.FromSeconds(8), ProjectileCollision = BulletHitsSomething}; 101 100 102 AddCollisionHandler(player, "platform", delegate(PhysicsObject a, PhysicsObject b) 101 103 { … … 104 106 AddCollisionHandler(player, "crate", delegate(PhysicsObject a, PhysicsObject b) 105 107 { 106 //((Player)a).Weapon = ((WeaponCrate)b).GiveWeapon(); 107 ((Player)a).Weapon = GunLottery(); 108 ((Player)a).Weapon.ProjectileCollision = BulletHitsSomething; 108 //((Player)a).Weapon = ((WeaponCrate)b).GiveWeapon(); 109 player.Weapon = GunLottery(); 109 110 b.Destroy(); 110 111 }); … … 113 114 } 114 115 115 void BulletHitsSomething 116 void BulletHitsSomething(PhysicsObject bullet, PhysicsObject target) 116 117 { 117 118 if (target.Tag == "platform") … … 132 133 Weapon GunLottery() 133 134 { 134 return new AssaultRifle( 50, 50);135 return new AssaultRifle(TILE_SIZE / 2, TILE_SIZE / 2) { FireRate = 1.5, AttackSound = null, MaxAmmoLifetime = TimeSpan.FromSeconds(8), ProjectileCollision = BulletHitsSomething }; 135 136 } 136 137 … … 148 149 }; 149 150 Add(announcement); 150 151 151 152 152 } … … 175 175 ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, Aim, "Tähtää", red); 176 176 ControllerOne.ListenAnalog(AnalogControl.RightTrigger, 0.1, Shoot, "", red); 177 ControllerOne.ListenAnalog(AnalogControl.LeftTrigger, 0.1, Shoot, "", red); 177 178 178 179 ControllerTwo.ListenAnalog(AnalogControl.LeftStick, 0.1, Move, "Liikuta pelaajaa", blue); … … 180 181 ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, Aim, null, blue); 181 182 ControllerTwo.ListenAnalog(AnalogControl.RightTrigger, 0.1, Shoot, "", blue); 183 ControllerTwo.ListenAnalog(AnalogControl.LeftTrigger, 0.1, Shoot, "", blue); 182 184 183 185 Keyboard.Listen(Key.F1, ButtonState.Pressed, ShowControlHelp, "Ohjeet"); … … 210 212 } 211 213 212 void Aim(AnalogState tatinTila, Player player)214 void Aim(AnalogState stickState, Player player) 213 215 { 214 216
Note: See TracChangeset
for help on using the changeset viewer.