Changeset 7428


Ignore:
Timestamp:
2016-06-17 11:10:09 (7 years ago)
Author:
karkaite
Message:

I have kind of completed the game. If i had little bit more time, I could completed making the game.

Location:
2016/24/HaseebS/Dreamcast
Files:
2 added
11 edited

Legend:

Unmodified
Added
Removed
  • 2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/Dreamcast.cs

    r7380 r7428  
    1616    AssaultRifle Player1Gun; 
    1717    AssaultRifle Player2Gun; 
     18    Image wallpaper = LoadImage("cool"); 
     19    int characterHealth; 
     20    int character2Health; 
     21    
    1822 
    1923    public override void Begin() 
     
    2125   
    2226    { 
    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 
    3233 
    3334    } 
     
    4950        obstacles.Position = place; 
    5051        obstacles.Shape = Shape.Rectangle; 
    51         obstacles.Color = Color.GreenYellow; 
     52        obstacles.Color = Color.OrangeRed; 
    5253         
    5354        Add(obstacles); 
     
    5960        wall.Position = place; 
    6061        wall.Shape = Shape.Rectangle; 
    61         wall.Color = Color.Brown; 
     62        wall.Color = Color.DarkGray; 
    6263        wall.CollisionIgnoreGroup = 1; 
     64        wall.IsVisible = true; 
    6365        Add(wall); 
    6466    } 
     
    6769        PhysicsObject ground = PhysicsObject.CreateStaticObject(width, height); 
    6870        ground.Position = place; 
    69         ground.Color = Color.Gray; 
     71        ground.Color = Color.Black; 
    7072        ground.Shape = Shape.Rectangle; 
     73        ground.IsVisible = false; 
    7174        //ground.CollisionIgnoreGroup = 1; 
    7275        Add(ground); 
     
    8184        character.CollisionIgnoreGroup = 1; 
    8285        character.Image = player1Picture; 
     86        character.Tag = "character"; 
     87        characterHealth = 5; 
     88        AddCollisionHandler(character, "character2", PlayerIsHit); 
    8389        Add(character); 
    8490 
     
    95101        character2.CollisionIgnoreGroup = 1; 
    96102        character2.Image = Image.Mirror(player2picture); 
     103        character2.Tag = "character2"; 
     104        AddCollisionHandler(character2, "character", PlayerIsHit); 
     105        character2Health = 5; 
    97106        Add(character2); 
    98107 
     
    104113        Player1Gun = new AssaultRifle(30, 10); 
    105114        Player1Gun.Ammo.Value = 1000; 
    106         Player1Gun.MaxAmmoLifetime = TimeSpan.FromSeconds(3.0); 
     115        Player1Gun.MaxAmmoLifetime = TimeSpan.FromSeconds(0.9); 
     116        Player1Gun.ProjectileCollision = ProjectileHit; 
    107117        //Add(Player1Gun); 
    108118        character.Weapon = Player1Gun; 
     
    112122        Player2Gun = new AssaultRifle(30, 10); 
    113123        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); 
    116126        character2.Weapon = Player2Gun; 
    117127    } 
     
    125135        if (ammo != null) 
    126136        { 
    127             //ammo.Size *= 2; 
     137            ammo.Size *= 0.8; 
    128138        } 
    129139    } 
     
    143153        Keyboard.Listen(Key.Right, ButtonState.Down, movement, "Player 2 will move right", character2, new Vector(100.0, 0.0));  
    144154        Keyboard.Listen(Key.Space, ButtonState.Pressed, Shootthegun, "Shoot button for Player2", Player2Gun ); 
    145          
     155 
    146156        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    147157 
     158 
    148159    } 
    149160    void movement(PlatformCharacter player, Vector move) 
     
    155166        player.Jump(jump.Y); 
    156167    } 
    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  
    22Content\Player2.xnb 
    33Content\Player1.xnb 
     4Content\cool.xnb 
    45Content\Hassebproject.txt 
  • 2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/obj/x86/Debug/ContentPipeline-{13E4EC85-E490-4DBC-A04D-2ED8958B34E1}.xml

    r7380 r7428  
    2828      <Output>C:\MyTemp\HaseebS\Dreamcast\Dreamcast\Dreamcast\bin\x86\Debug\Content\Player1.xnb</Output> 
    2929      <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> 
    3039    </Item> 
    3140    <BuildSuccessful>true</BuildSuccessful> 
  • 2016/24/HaseebS/Dreamcast/Dreamcast/Dreamcast/obj/x86/Debug/Dreamcast.csproj.FileListAbsolute.txt

    r7380 r7428  
    1111C:\MyTemp\HaseebS\Dreamcast\Dreamcast\Dreamcast\bin\x86\Debug\Content\Player2.xnb 
    1212C:\MyTemp\HaseebS\Dreamcast\Dreamcast\Dreamcast\bin\x86\Debug\Content\Player1.xnb 
     13C:\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  
    22Content\Player2.xnb 
    33Content\Player1.xnb 
     4Content\cool.xnb 
    45Content\Hassebproject.txt 
  • 2016/24/HaseebS/Dreamcast/Dreamcast/DreamcastContent/DreamcastContent.contentproj

    r7380 r7428  
    6767    </Compile> 
    6868  </ItemGroup> 
     69  <ItemGroup> 
     70    <Compile Include="cool.jpg"> 
     71      <Name>cool</Name> 
     72      <Importer>TextureImporter</Importer> 
     73      <Processor>TextureProcessor</Processor> 
     74    </Compile> 
     75  </ItemGroup> 
    6976  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    7077  <!--  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.