Changeset 5962 for 2015/24


Ignore:
Timestamp:
2015-06-09 15:14:29 (8 years ago)
Author:
iisaaira
Message:
 
Location:
2015/24/TuroR/Omapeli
Files:
15 added
15 edited

Legend:

Unmodified
Added
Removed
  • 2015/24/TuroR/Omapeli/Omapeli/Omapeli/Omapeli.cs

    r5908 r5962  
    99public class Omapeli : PhysicsGame 
    1010{ 
     11    IntMeter pisteLaskuri; 
     12 
     13    Image panoksenKuva = LoadImage("panos"); 
     14 
     15    Image[] pallonKuvat = LoadImages("apina", "UUS APINA", "sukkamato", "silma", "kännykkä", "Cannon"); 
     16 
    1117    AssaultRifle pelaajan1Ase; 
    1218 
     
    1521    public override void Begin() 
    1622    { 
     23        LuoUusiApina(); 
    1724 
    18         Gravity = new Vector(0, -500); 
     25        Gravity = new Vector(0, -1000); 
    1926 
    2027        //tykki.ProjectileCollision = AmmusOsui; 
     28 
     29        IsFullScreen = false; 
     30        IsMouseVisible = true; 
     31        Level.Width = Screen.Width; 
     32        Level.Height = Screen.Height; 
     33 
     34        Level.CreateRightBorder(1.0, false); 
     35        Level.CreateLeftBorder(1.0, false); 
     36        PhysicsObject ylaReuna = Level.CreateTopBorder(1.0, false); 
    2137         
    22         IsFullScreen = false; 
    23         Level.Width = Screen.Width; 
    2438 
    2539        Surface alaReuna = Surface.CreateBottom(Level, 30, 100, 40, 10); 
     40        alaReuna.Y = Screen.Bottom + 100; 
    2641        Add(alaReuna); 
    27          
     42 
    2843        PlatformCharacter2 ukko = new PlatformCharacter2(50, 50); 
    2944        ukko.Shape = Shape.Circle; 
     
    3853 
    3954        pelaajan1Ase.Ammo.Value = 1000; 
     55        pelaajan1Ase.ProjectileCollision = AmmusOsui; 
     56        ukko.Add(pelaajan1Ase); 
    4057 
    41         pelaajan1Ase.ProjectileCollision = AmmusOsui; 
    42  
    43  
    44         ukko.Add(pelaajan1Ase); 
     58        LuoPistelaskuri(); 
    4559 
    4660        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    4761        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
    48         Keyboard.Listen(Key.Space, ButtonState.Down, AmmuAseella, "Ammu", pelaajan1Ase); 
    49         Keyboard.Listen(Key.Up, ButtonState.Down, Hyppääukolla, "Hyppää", ukko); 
     62        Mouse.Listen(MouseButton.Left, ButtonState.Down, AmmuAseella, "Ammu", pelaajan1Ase); 
     63        Keyboard.Listen(Key.W, ButtonState.Down, Hyppääukolla, "Hyppää", ukko); 
     64        Keyboard.Listen(Key.A, ButtonState.Down, Liiku, "Liiku", ukko, Direction.Left); 
     65        Keyboard.Listen(Key.D, ButtonState.Down, Liiku, "Liiku", ukko, Direction.Right); 
     66        Mouse.ListenMovement(0.0, HiirenLiikutus, "Tahtaa", ukko); 
    5067    } 
    5168 
    5269    void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 
    5370    { 
    54         //ammus.Destroy(); 
     71        ammus.Destroy(); 
     72 
     73         
     74 
     75        if (kohde.Tag.Equals("apina")) 
     76        { 
     77            Timer.SingleShot(2.0, delegate { LuoUusiApina(); }); 
     78            kohde.Destroy(); 
     79            Explosion rajahdys = new Explosion(100); 
     80            rajahdys.Position = ammus.Position; 
     81            Add(rajahdys); 
     82 
     83            pisteLaskuri.Value += 1; 
     84 
     85        } 
    5586    } 
    5687 
     
    6192        if (ammus != null) 
    6293        { 
    63             //ammus.Size *= 3; 
    64             //ammus.Image = ... 
    65             //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
     94            ammus.Image = panoksenKuva; 
     95            ammus.Velocity = ammus.AbsoluteAngle.GetVector()*3000; 
    6696        } 
    6797    } 
    6898 
    69         void Hyppääukolla(PlatformCharacter2 ukko) 
     99    void Hyppääukolla(PlatformCharacter2 ukko) 
    70100    { 
    71101        ukko.Jump(500.0); 
    72102    } 
     103 
     104    void Liiku(PlatformCharacter2 ukko, Direction suunta) 
     105    { 
     106        ukko.Walk(suunta); 
     107        pelaajan1Ase.X = 21.0*suunta.GetVector().X; 
     108    } 
     109 
     110    void HiirenLiikutus(AnalogState Hiiri, PlatformCharacter2 ukko) 
     111    { 
     112        pelaajan1Ase.AbsoluteAngle = (Mouse.PositionOnWorld - ukko.Position).Angle; 
     113 
     114    } 
     115 
     116    void LuoUusiApina() 
     117    { 
     118        PhysicsObject apina = new PhysicsObject(50, 50); 
     119        apina.Shape = Shape.Circle; 
     120        apina.IgnoresGravity = true; 
     121        apina.Hit(new Vector(-500, 200)); 
     122 
     123        Double Xkoordinaatti = RandomGen.NextDouble(Level.Left, Level.Right); 
     124        apina.Position = new Vector(Xkoordinaatti,0); 
     125        apina.Restitution = 1.0; 
     126        apina.Tag = "apina"; 
     127        apina.Image = pallonKuvat[RandomGen.NextInt(pallonKuvat.Length)]; 
     128        Add(apina); 
     129    } 
     130 
     131    void LuoPistelaskuri() 
     132    { 
     133        pisteLaskuri = new IntMeter(0); 
     134 
     135        Label pisteNaytto = new Label(); 
     136        pisteNaytto.X = Screen.Left + 100; 
     137        pisteNaytto.Y = Screen.Top - 100; 
     138        pisteNaytto.TextColor = Color.Black; 
     139        pisteNaytto.Color = Color.White; 
     140 
     141        pisteNaytto.BindTo(pisteLaskuri); 
     142        Add(pisteNaytto); 
     143    } 
    73144} 
    74  
  • 2015/24/TuroR/Omapeli/Omapeli/Omapeli/Omapeli.csproj.Debug.cachefile

    r5908 r5962  
    11Content\Cannon.xnb 
    22Content\ukko.xnb 
     3Content\apina.xnb 
     4Content\panos.xnb 
     5Content\UUS APINA.xnb 
     6Content\sukkamato.xnb 
     7Content\silma.xnb 
     8Content\kÀnnykkÀ.xnb 
  • 2015/24/TuroR/Omapeli/Omapeli/Omapeli/obj/x86/Debug/Omapeli.csproj.FileListAbsolute.txt

    r5908 r5962  
    99C:\MyTemp\TuroR\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Omapeli.csprojResolveAssemblyReference.cache 
    1010C:\MyTemp\TuroR\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\ukko.xnb 
     11C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\Cannon.xnb 
     12C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\ukko.xnb 
     13C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Omapeli.exe 
     14C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Omapeli.pdb 
     15C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Jypeli.dll 
     16C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Jypeli.xml 
     17C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Omapeli.csprojResolveAssemblyReference.cache 
     18C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt 
     19C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Omapeli.exe 
     20C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\obj\x86\Debug\Omapeli.pdb 
     21C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\apina.xnb 
     22C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\panos.xnb 
     23C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\UUS APINA.xnb 
     24C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\sukkamato.xnb 
     25C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\silma.xnb 
     26C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\Omapeli\bin\x86\Debug\Content\kÀnnykkÀ.xnb 
  • 2015/24/TuroR/Omapeli/Omapeli/Omapeli/obj/x86/Debug/cachefile-{595E6F62-26BF-42FB-ABC6-C9280882E6ED}-targetpath.txt

    r5908 r5962  
    11Content\Cannon.xnb 
    22Content\ukko.xnb 
     3Content\apina.xnb 
     4Content\panos.xnb 
     5Content\UUS APINA.xnb 
     6Content\sukkamato.xnb 
     7Content\silma.xnb 
     8Content\kÀnnykkÀ.xnb 
  • 2015/24/TuroR/Omapeli/Omapeli/OmapeliContent/OmapeliContent.contentproj

    r5908 r5962  
    5959    </Compile> 
    6060  </ItemGroup> 
     61  <ItemGroup> 
     62    <Compile Include="apina.png"> 
     63      <Name>apina</Name> 
     64      <Importer>TextureImporter</Importer> 
     65      <Processor>TextureProcessor</Processor> 
     66    </Compile> 
     67  </ItemGroup> 
     68  <ItemGroup> 
     69    <Compile Include="panos.png"> 
     70      <Name>panos</Name> 
     71      <Importer>TextureImporter</Importer> 
     72      <Processor>TextureProcessor</Processor> 
     73    </Compile> 
     74  </ItemGroup> 
     75  <ItemGroup> 
     76    <Compile Include="UUS APINA.png"> 
     77      <Name>UUS APINA</Name> 
     78      <Importer>TextureImporter</Importer> 
     79      <Processor>TextureProcessor</Processor> 
     80    </Compile> 
     81  </ItemGroup> 
     82  <ItemGroup> 
     83    <Compile Include="sukkamato.png"> 
     84      <Name>sukkamato</Name> 
     85      <Importer>TextureImporter</Importer> 
     86      <Processor>TextureProcessor</Processor> 
     87    </Compile> 
     88  </ItemGroup> 
     89  <ItemGroup> 
     90    <Compile Include="silma.png"> 
     91      <Name>silma</Name> 
     92      <Importer>TextureImporter</Importer> 
     93      <Processor>TextureProcessor</Processor> 
     94    </Compile> 
     95  </ItemGroup> 
     96  <ItemGroup> 
     97    <Compile Include="kännykkä.png"> 
     98      <Name>kännykkä</Name> 
     99      <Importer>TextureImporter</Importer> 
     100      <Processor>TextureProcessor</Processor> 
     101    </Compile> 
     102  </ItemGroup> 
    61103  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    62104  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2015/24/TuroR/Omapeli/Omapeli/OmapeliContent/obj/x86/Debug/OmapeliContent.contentproj.FileListAbsolute.txt

    r5908 r5962  
    11C:\MyTemp\TuroR\Omapeli\Omapeli\OmapeliContent\obj\x86\Debug\OmapeliContent.contentprojResolveAssemblyReference.cache 
     2C:\MyTemp\TuroR\UusiPeli\Omapeli\Omapeli\OmapeliContent\obj\x86\Debug\OmapeliContent.contentprojResolveAssemblyReference.cache 
Note: See TracChangeset for help on using the changeset viewer.