Changeset 7428
- Timestamp:
- 2016-06-17 11:10:09 (7 years ago)
- Location:
- 2016/24/HaseebS/Dreamcast
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/Dreamcast.cs
r7380 r7428 16 16 AssaultRifle Player1Gun; 17 17 AssaultRifle Player2Gun; 18 Image wallpaper = LoadImage("cool"); 19 int characterHealth; 20 int character2Health; 21 18 22 19 23 public override void Begin() … … 21 25 22 26 { 23 CreateLevel(); 24 Camera.ZoomToAllObjects(); 25 addControl(); 26 Gravity = new Vector(0.0, -300.0); 27 28 29 30 31 27 startMenu(); 28 29 30 31 32 32 33 33 34 } … … 49 50 obstacles.Position = place; 50 51 obstacles.Shape = Shape.Rectangle; 51 obstacles.Color = Color. GreenYellow;52 obstacles.Color = Color.OrangeRed; 52 53 53 54 Add(obstacles); … … 59 60 wall.Position = place; 60 61 wall.Shape = Shape.Rectangle; 61 wall.Color = Color. Brown;62 wall.Color = Color.DarkGray; 62 63 wall.CollisionIgnoreGroup = 1; 64 wall.IsVisible = true; 63 65 Add(wall); 64 66 } … … 67 69 PhysicsObject ground = PhysicsObject.CreateStaticObject(width, height); 68 70 ground.Position = place; 69 ground.Color = Color. Gray;71 ground.Color = Color.Black; 70 72 ground.Shape = Shape.Rectangle; 73 ground.IsVisible = false; 71 74 //ground.CollisionIgnoreGroup = 1; 72 75 Add(ground); … … 81 84 character.CollisionIgnoreGroup = 1; 82 85 character.Image = player1Picture; 86 character.Tag = "character"; 87 characterHealth = 5; 88 AddCollisionHandler(character, "character2", PlayerIsHit); 83 89 Add(character); 84 90 … … 95 101 character2.CollisionIgnoreGroup = 1; 96 102 character2.Image = Image.Mirror(player2picture); 103 character2.Tag = "character2"; 104 AddCollisionHandler(character2, "character", PlayerIsHit); 105 character2Health = 5; 97 106 Add(character2); 98 107 … … 104 113 Player1Gun = new AssaultRifle(30, 10); 105 114 Player1Gun.Ammo.Value = 1000; 106 Player1Gun.MaxAmmoLifetime = TimeSpan.FromSeconds(3.0); 115 Player1Gun.MaxAmmoLifetime = TimeSpan.FromSeconds(0.9); 116 Player1Gun.ProjectileCollision = ProjectileHit; 107 117 //Add(Player1Gun); 108 118 character.Weapon = Player1Gun; … … 112 122 Player2Gun = new AssaultRifle(30, 10); 113 123 Player2Gun.Ammo.Value = 1000; 114 // player2 gun project tile collision = what happens after the bullet hit someone();115 Player2Gun.MaxAmmoLifetime = TimeSpan.FromSeconds( 3.0);124 Player2Gun.ProjectileCollision = ProjectileHit; 125 Player2Gun.MaxAmmoLifetime = TimeSpan.FromSeconds(0.9); 116 126 character2.Weapon = Player2Gun; 117 127 } … … 125 135 if (ammo != null) 126 136 { 127 //ammo.Size *= 2;137 ammo.Size *= 0.8; 128 138 } 129 139 } … … 143 153 Keyboard.Listen(Key.Right, ButtonState.Down, movement, "Player 2 will move right", character2, new Vector(100.0, 0.0)); 144 154 Keyboard.Listen(Key.Space, ButtonState.Pressed, Shootthegun, "Shoot button for Player2", Player2Gun ); 145 155 146 156 Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 147 157 158 148 159 } 149 160 void movement(PlatformCharacter player, Vector move) … … 155 166 player.Jump(jump.Y); 156 167 } 157 158 } 168 void PlayerIsHit(PhysicsObject player, PhysicsObject target) 169 { 170 characterHealth--; 171 172 if (characterHealth <= 0) 173 { 174 player.Destroy(); 175 } 176 } 177 void startMenu() 178 { 179 MultiSelectWindow alkuValikko = new MultiSelectWindow("Pelin alkuvalikko", 180 "Start Game", "Instructions", "Exit"); 181 alkuValikko.AddItemHandler(0, startGame); 182 alkuValikko.AddItemHandler(1, instruction); 183 alkuValikko.AddItemHandler(2, Exit); 184 Add(alkuValikko); 185 186 alkuValikko.Color = Color.Red; 187 } 188 void startGame() 189 { 190 CreateLevel(); 191 Camera.ZoomToAllObjects(); 192 addControl(); 193 Gravity = new Vector(0.0, -420.0); 194 Level.Background.Image = wallpaper; 195 IsFullScreen = true; 196 197 198 199 } 200 void instruction() 201 { 202 Label instruction = new Label(); 203 instruction.Text = "Both player have 5 lives."; 204 Add(instruction); 205 } 206 void exit() 207 { 208 209 } 210 211 } -
2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/Dreamcast.csproj.Debug.cachefile
r7380 r7428 2 2 Content\Player2.xnb 3 3 Content\Player1.xnb 4 Content\cool.xnb 4 5 Content\Hassebproject.txt -
2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/obj/x86/Debug/ContentPipeline-{13E4EC85-E490-4DBC-A04D-2ED8958B34E1}.xml
r7380 r7428 28 28 <Output>C:\MyTemp\HaseebS\Dreamcast\Dreamcast\Dreamcast\bin\x86\Debug\Content\Player1.xnb</Output> 29 29 <Time>2016-06-16T13:49:02.8431423+03:00</Time> 30 </Item> 31 <Item> 32 <Source>cool.jpg</Source> 33 <Name>cool</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\HaseebS\Dreamcast\Dreamcast\Dreamcast\bin\x86\Debug\Content\cool.xnb</Output> 38 <Time>2016-06-17T10:06:51.1407012+03:00</Time> 30 39 </Item> 31 40 <BuildSuccessful>true</BuildSuccessful> -
2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/obj/x86/Debug/Dreamcast.csproj.FileListAbsolute.txt
r7380 r7428 11 11 C:\MyTemp\HaseebS\Dreamcast\Dreamcast\Dreamcast\bin\x86\Debug\Content\Player2.xnb 12 12 C:\MyTemp\HaseebS\Dreamcast\Dreamcast\Dreamcast\bin\x86\Debug\Content\Player1.xnb 13 C:\MyTemp\HaseebS\Dreamcast\Dreamcast\Dreamcast\bin\x86\Debug\Content\cool.xnb -
2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/obj/x86/Debug/cachefile-{13E4EC85-E490-4DBC-A04D-2ED8958B34E1}-targetpath.txt
r7380 r7428 2 2 Content\Player2.xnb 3 3 Content\Player1.xnb 4 Content\cool.xnb 4 5 Content\Hassebproject.txt -
2016/24/HaseebS/Dreamcast/Dreamcast/DreamcastContent/DreamcastContent.contentproj
r7380 r7428 67 67 </Compile> 68 68 </ItemGroup> 69 <ItemGroup> 70 <Compile Include="cool.jpg"> 71 <Name>cool</Name> 72 <Importer>TextureImporter</Importer> 73 <Processor>TextureProcessor</Processor> 74 </Compile> 75 </ItemGroup> 69 76 <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 70 77 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.