- Timestamp:
- 2010-07-08 12:28:15 (13 years ago)
- Location:
- 2010/27/julkivim/CCCP/FysiikkaPeli1
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
2010/27/julkivim/CCCP/FysiikkaPeli1/Content/Content.contentproj
r1160 r1180 42 42 </Compile> 43 43 </ItemGroup> 44 <ItemGroup> 45 <Compile Include="bullet.png"> 46 <Name>bullet</Name> 47 <Importer>TextureImporter</Importer> 48 <Processor>TextureProcessor</Processor> 49 </Compile> 50 </ItemGroup> 44 51 </Project> -
2010/27/julkivim/CCCP/FysiikkaPeli1/FysiikkaPeli1.csproj
r1166 r1180 87 87 </ItemGroup> 88 88 <ItemGroup> 89 <Content Include="bullet.png" /> 89 90 <Content Include="Game.ico" /> 90 91 <Content Include="GameThumbnail.png" /> -
2010/27/julkivim/CCCP/FysiikkaPeli1/Peli.cs
r1168 r1180 25 25 ruudut['='] = LuoPalikka; 26 26 ruudut.Insert(ruudunLeveys, ruudunKorkeus); 27 27 Level.BackgroundColor = Color.White; 28 28 Camera.ZoomToLevel(); 29 29 PhysicsObject kissa = new PhysicsObject(40, 20); … … 31 31 kissa.Mass = 10.0; 32 32 Add(kissa); 33 33 34 34 } 35 35 … … 42 42 { 43 43 PhysicsObject palikka = PhysicsObject.CreateStaticObject(20.0, 20.0); 44 44 Add(palikka); 45 45 palikka.Color = Color.Black; 46 46 … … 49 49 PhysicsObject kissa; 50 50 51 void ABC()51 void ABC() 52 52 { 53 53 kissa = new PhysicsObject(100, 200); 54 kissa.Tag = "pelaaja"; 54 55 Add(kissa); 55 56 pyssy = new AssaultRifle(100, 100); 57 58 pyssy.BulletCollision = ammusOsuu; 59 60 61 56 62 kissa.Add(pyssy); 57 63 pyssy.Ammo.Value = 500; 58 59 64 kissa.Color = Color.Black; 60 65 Keyboard.Listen(Key.Left, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0)); 61 66 Keyboard.Listen(Key.Right, ButtonState.Down, LiikutaPelaajaa, null, new Vector(1000, 0)); 62 67 Keyboard.Listen(Key.Up, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, 1000)); 63 68 Keyboard.Listen(Key.Down, ButtonState.Down, LiikutaPelaajaa, null, new Vector(0, -1000)); 64 Keyboard.Listen(Key.Space, ButtonState.Down, pyssy.Use, "ammu");69 Keyboard.Listen(Key.Space, ButtonState.Down, ammuAseella, "ammu"); 65 70 ControllerOne.Listen(Button.DPadLeft, ButtonState.Down, LiikutaPelaajaa, null, new Vector(-1000, 0)); 66 71 ControllerOne.Listen(Button.DPadRight, ButtonState.Down, LiikutaPelaajaa, null, new Vector(1000, 0)); … … 69 74 ControllerOne.ListenAnalog(AnalogControl.LeftStick, 0.1, LiikutaPelaajaa, "Liikuta pelaajaa tattia pyörittämällä."); 70 75 ControllerOne.Listen(Button.A, ButtonState.Down, pyssy.Use, "ammu"); 71 72 Mouse.IsCursorVisible = true;76 77 Mouse.IsCursorVisible = true; 73 78 Mouse.ListenMovement(0.1, KuunteleLiiketta, null); 74 } 79 80 } 81 void ammuAseella() 82 { 83 84 PhysicsObject ammus = pyssy.Shoot(); 85 if (ammus != null) 86 { 87 ammus.Size = new Vector(50, 50); 88 ammus.Image = LoadImage("bullet"); 89 //ammus.Hit(new Vector(200, 0)); 90 //Add(ammus); 91 } 92 93 } 75 94 76 95 void LiikutaPelaajaa(Vector vektori) … … 87 106 pyssy.Angle = suunta.Angle; 88 107 } 108 void ammusOsuu(PhysicsObject ammus, PhysicsObject toinen) 109 { 110 if (toinen.Tag.ToString() != "pelaaja") 111 { 112 ammus.Destroy(); 113 Explosion rajahdys = new Explosion(40); 114 rajahdys.Position = ammus.Position; 115 Add(rajahdys); 116 } 117 } 89 118 void LiikutaPelaajaa(AnalogState tatinTila) 90 119 {
Note: See TracChangeset
for help on using the changeset viewer.