- Timestamp:
- 2011-08-03 14:56:13 (12 years ago)
- Location:
- 2011/31/PeetuL/Palikoiden sota/Palikoiden sota/Palikoiden sota
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/31/PeetuL/Palikoiden sota/Palikoiden sota/Palikoiden sota/Palikoiden sota.csproj
r2496 r2532 120 120 </ItemGroup> 121 121 <ItemGroup> 122 <ProjectReference Include="..\Palikoiden_sotaContent\Palikoiden_sotaContent.contentproj">123 <Name>Palikoiden_sotaContent</Name>124 <XnaReferenceType>Content</XnaReferenceType>125 </ProjectReference>126 </ItemGroup>127 <ItemGroup>128 122 <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client"> 129 123 <Visible>False</Visible> … … 152 146 </BootstrapperPackage> 153 147 </ItemGroup> 148 <ItemGroup> 149 <ProjectReference Include="..\Palikoiden sotaContent\Palikoiden sotaContent.contentproj"> 150 <Project>{ED737E00-3B34-404A-9B99-C09A82AB4F97}</Project> 151 <Name>Palikoiden sotaContent %28Content%29</Name> 152 <XnaReferenceType>Content</XnaReferenceType> 153 </ProjectReference> 154 </ItemGroup> 154 155 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 155 156 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" /> -
2011/31/PeetuL/Palikoiden sota/Palikoiden sota/Palikoiden sota/Peli.cs
r2496 r2532 9 9 public class Peli : PhysicsGame 10 10 { 11 RandomMoverBrain SatunnaisAivot = new RandomMoverBrain(); 12 PlatformCharacter Behqulo; 13 11 14 public override void Begin() 12 15 { 16 LuoAleksikuutio(); 17 LuoBehqulo(); 18 13 19 // TODO: Kirjoita ohjelmakoodisi tähän 14 20 15 PlatformCharacter Behqulo = new PlatformCharacter(5.0, 10.0 ); 16 Add (Behqulo); 21 22 23 24 Camera.Follow(Behqulo); 25 Gravity = new Vector(0.0, -1100.0); 26 27 28 29 int i = 0; 30 while (i < 10) 31 { 32 LuoPahis(); 33 // i++; 34 i = i + 1; 35 36 } 37 38 int u = 0; 39 while (u < 10) 40 { 41 LuoLaserpahis(); 42 u = u + 1; 43 } 44 45 Level.CreateGround(55, 45, 7, 5); 46 } 47 void LuoPahis() 48 { 49 PlatformCharacter pahis = new PlatformCharacter(10.0, 10.0); 50 pahis.X = RandomGen.NextDouble(Level.Left, Level.Right); 51 pahis.Shape = Shape.Circle; 52 pahis.Color = Color.Green; 53 // if (pahis.IsDestroyed); 54 pahis.Weapon = new AssaultRifle(20, 5); 55 Vector suunta = (Behqulo.Position - pahis.Position).Normalize(); 56 pahis.Angle = suunta.Angle; 57 Timer ajastin = new Timer(); 58 ajastin.Interval = 1.0; 59 ajastin.Timeout += delegate { PahisAmpuu(pahis); }; 60 ajastin.Start(); 61 pahis.Brain = new RandomMoverBrain(1000.0); 62 Add(pahis); 63 } 64 65 66 67 68 void LiikutaBehquloa(Vector Vektori) 69 { 70 Behqulo.Push(Vektori); 71 } 72 73 void Ammu() 74 { 75 Behqulo.Weapon.Shoot(); 76 77 78 } 79 80 81 void LuoBehqulo() 82 { 83 Behqulo = new PlatformCharacter(10.0, 15.0); 84 Add(Behqulo); 17 85 Behqulo.Shape = Shape.Rectangle; 18 86 Behqulo.Color = Color.Yellow; 87 Behqulo.Weapon = new AssaultRifle(20, 5); 88 89 Keyboard.Listen(Key.D, ButtonState.Down, 90 LiikutaBehquloa, null, new Vector(1000, 0)); 91 Keyboard.Listen(Key.A, ButtonState.Down, 92 LiikutaBehquloa, null, new Vector(-1000, 0)); 93 Keyboard.Listen(Key.W, ButtonState.Down, 94 LiikutaBehquloa, null, new Vector(0, 1000)); 95 Mouse.Listen(MouseButton.Left, ButtonState.Pressed, 96 Ammu, null); 97 Mouse.IsCursorVisible = true; 98 99 } 100 void LuoLaserpahis() 101 { 102 PlatformCharacter Laserpahis = new PlatformCharacter(11.0, 10.3); 103 Laserpahis.X = RandomGen.NextDouble(Level.Left, Level.Right); 104 Laserpahis.Shape = Shape.Star; 105 Laserpahis.Color = Color.Green; 106 Laserpahis.Weapon = new LaserGun(5, 5); 107 Vector suunta = (Behqulo.Position - Laserpahis.Position).Normalize(); 108 109 110 Add(Laserpahis); 111 Timer ajastin = new Timer(); 112 ajastin.Interval = 1.0; 113 ajastin.Timeout += delegate { LaserPahisAmpuu(Laserpahis); }; 114 ajastin.Start(); 115 116 117 } 118 119 void PahisAmpuu(PlatformCharacter pahis) 120 { 121 pahis.Weapon.Shoot(); 122 } 123 124 void LaserPahisAmpuu(PlatformCharacter LaserPahis) 125 { 126 LaserPahis.Weapon.Shoot(); 127 128 } 129 130 void LuoAleksikuutio() 131 { 132 PlatformCharacter Aleksikuutio = new PlatformCharacter(100.0, 100.0); 133 Aleksikuutio.X = RandomGen.NextDouble(Level.Left, Level.Right); 134 Aleksikuutio.Color = Color.Violet; 135 Aleksikuutio.Weapon = new Cannon(60.0, 60.0); 19 136 20 PlatformCharacter pahis = new PlatformCharacter(1.0, 1.0); 21 Add(pahis); 22 pahis.Shape = Shape.Circle; 23 pahis.Color = Color.Green; 24 if (pahis.IsDestroyed); 25 pahis.Weapon = new AssaultRifle(20, 5); 26 Add(pahis); 27 Add(pahis); 28 Add(pahis); 29 Add(pahis); 30 Add(pahis); 31 Add(pahis); 32 Add(pahis); 33 Add(pahis); 34 Add(pahis); 35 Add(pahis); 36 Add(pahis); 37 Add(pahis); 38 Add(pahis); 39 Add(pahis); 40 Add(pahis); 41 Add(pahis); 42 Add(pahis); 43 Add(pahis); 44 Add(pahis); 45 Add(pahis); 46 Add(pahis); 47 Add(pahis); 48 Add(pahis); 49 Add(pahis); 50 Add(pahis); 51 Add(pahis); 52 Add(pahis); 53 Add(pahis); 54 Add(pahis); 55 Add(pahis); 56 Add(pahis); 57 Add(pahis); 58 59 60 Level.CreateGround(10,100,20 ); 61 62 63 64 65 66 137 Add(Aleksikuutio); 138 Timer ajastin = new Timer(); 139 ajastin.Interval = 2.0; 140 ajastin.Timeout += delegate { AleksikuutioAmpuu(Aleksikuutio); }; 141 Aleksikuutio.Brain = new RandomMoverBrain(); 142 ajastin.Start(); 67 143 } 144 145 void AleksikuutioAmpuu(PlatformCharacter Aleksikuutio) 146 { 147 PhysicsObject ammus = Aleksikuutio.Weapon.Shoot(); 148 if (ammus != null) 149 { 150 ammus.Size *= 5; 151 } 152 } 153 154 155 } 68 156 69 157 … … 81 169 82 170 83 } 171 172 173 174 175 176 177
Note: See TracChangeset
for help on using the changeset viewer.