Changeset 2237 for 2011/26


Ignore:
Timestamp:
2011-06-28 14:58:27 (12 years ago)
Author:
lijiolva
Message:

Talletus.

Location:
2011/26/LinusV/SFN/SFN-säätöä
Files:
7 added
12 edited

Legend:

Unmodified
Added
Removed
  • 2011/26/LinusV/SFN/SFN-säätöä/SFN-säätöä/SFN-säätöä/Peli.cs

    r2177 r2237  
    77using Jypeli.Widgets; 
    88 
    9 public class Peli : PhysicsGame 
     9public class Peli : TopDownPhysicsGame 
    1010{ 
    1111    Automobile kaara; 
    12     int engine; 
     12    int engine = 100; 
     13    int tires = 100; 
     14    PushButton new_game, load_game, quit_game; 
     15 
     16    Image MenuBackround = LoadImage("MenuBackround"); 
    1317    public override void Begin() 
    1418    { 
     19        Gravity = 200; 
     20        KineticFriction = 10; 
     21        Keyboard.Listen(Key.Escape, ButtonState.Released, Exit, null); 
     22        Mouse.IsCursorVisible = true; 
     23        CreateMenu(); 
     24    } 
     25 
     26    void CreateMenu() 
     27    { 
     28         
     29        //Set menu backround 
     30        Level.Background.Image = MenuBackround; 
     31 
     32        //Quit game button 
     33        quit_game = new PushButton("Quit game"); 
     34        quit_game.Clicked += new Action(quit_game_Clicked); 
     35        quit_game.Position = new Vector(380.0, -50.0); 
     36        Add(quit_game); 
     37 
     38        //Load game button  
     39        load_game = new PushButton("Load game"); 
     40        load_game.Clicked += new Action(load_game_Clicked); 
     41        load_game.Position = new Vector(200.0, -50.0); 
     42        Add(load_game); 
     43 
     44        //New game button 
     45        new_game = new PushButton("New game"); 
     46        new_game.Clicked += new Action(new_game_Clicked); 
     47        new_game.Position = new Vector(20.0, -50.0); 
     48        Add(new_game); 
     49    } 
     50 
     51    void new_game_Clicked() 
     52    { 
     53        //Sekalaista säätöä 
     54        Level.Background.Image = null; 
     55        Level.BackgroundColor = Color.LightGray; 
     56        Camera.ZoomFactor = 0.3; 
     57        new_game.Destroy(); 
     58        load_game.Destroy(); 
     59        quit_game.Destroy(); 
    1560        Keyboard.Listen(Key.Escape, ButtonState.Released, Exit, null); 
    1661        Window.AllowUserResizing = true; 
    1762        kaara = new Automobile(100, 50); 
    18         engine = 1; 
    1963        Add(kaara); 
    2064        Mouse.IsCursorVisible = true; 
    2165        Keyboard.Listen(Key.Up, ButtonState.Down, kaasu, null); 
     66        Keyboard.Listen(Key.Left, ButtonState.Down, rattiV, null); 
     67        Keyboard.Listen(Key.Right, ButtonState.Down, rattiO, null); 
     68        Keyboard.Listen(Key.Down, ButtonState.Down, jarru, null); 
     69        Keyboard.Listen(Key.RightControl, ButtonState.Down, jarru, null); 
     70        Camera.FollowedObject = kaara; 
     71        kaara.TopSpeed = engine * 100; 
     72        kaara.Acceleration = engine * 10; 
     73        kaara.KineticFriction = tires * 10; 
     74        kaara.StaticFriction = tires * 10; 
     75        kaara.Maneuverability = Angle.FromDegrees(tires); 
     76        kaara.BrakeDeceleration = tires * 20; 
     77        kaara.Image = LoadImage("Sporttinen2"); 
     78        kaara.X = Level.Left + 50; 
     79        kaara.MomentOfInertia = 1000; 
     80        kaara.LinearDamping = 0.99; 
     81        kaara.Mass = 1000; 
     82        kaara.AngularDamping = 0.95; 
     83 
     84        //Kartan lataus 
     85        TileMap World = TileMap.FromFile("Map.txt"); 
     86        World.SetTileMethod('A', taloA); 
     87        World.SetTileMethod('B', taloB); 
     88        World.SetTileMethod('C', taloC); 
     89        World.Execute(101,101); 
     90    } 
     91 
     92    void load_game_Clicked() 
     93    { 
     94        MessageDisplay.Add("Can't load game. Game save system not availible."); 
     95    } 
     96 
     97    void quit_game_Clicked() 
     98    { 
     99        //Crediittejä tänne? 
     100        Exit(); 
    22101    } 
    23102 
    24103    public void kaasu() 
    25104    { 
    26         //kaara.Push(power); 
     105        kaara.Accelerate(Time.SinceLastUpdate.TotalSeconds); 
     106    } 
     107    public void rattiV() 
     108    { 
     109        if (kaara.Velocity.Magnitude > 1) { kaara.Turn(Angle.FromDegrees(1), Time.SinceLastUpdate.TotalSeconds); } 
     110    } 
     111    public void rattiO() 
     112    { 
     113        if (kaara.Velocity.Magnitude > 1) { kaara.Turn(Angle.FromDegrees(-1), Time.SinceLastUpdate.TotalSeconds); } 
     114    } 
     115    public void jarru() 
     116    { 
     117        if (kaara.Velocity.Magnitude > 1) {kaara.Brake(Time.SinceLastUpdate.TotalSeconds);} 
     118    } 
     119 
     120    //Talot 
     121    void taloA(Vector paikka, double leveys, double korkeus) 
     122    { 
     123        PhysicsObject talo = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     124        talo.Position = paikka; 
     125        talo.Image = LoadImage("Talo1"); 
     126        Add(talo); 
     127    } 
     128    void taloB(Vector paikka, double leveys, double korkeus) 
     129    { 
     130        PhysicsObject talo = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     131        talo.Position = paikka; 
     132        talo.Image = LoadImage("Talo2"); 
     133        Add(talo); 
     134    } 
     135    void taloC(Vector paikka, double leveys, double korkeus) 
     136    { 
     137        PhysicsObject talo = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     138        talo.Position = paikka; 
     139        talo.Image = LoadImage("Talo3"); 
     140        Add(talo); 
    27141    } 
    28142} 
  • 2011/26/LinusV/SFN/SFN-säätöä/SFN-säätöä/SFN-säätöä/SFN-säätöä.csproj

    r2169 r2237  
    118118    <Content Include="Game.ico" /> 
    119119    <Content Include="GameThumbnail.png" /> 
    120   </ItemGroup> 
    121   <ItemGroup> 
    122     <ProjectReference Include="..\SFN_säätöäContent\SFN_säätöäContent.contentproj"> 
    123       <Name>SFN_säätöäContent</Name> 
    124       <XnaReferenceType>Content</XnaReferenceType> 
    125     </ProjectReference> 
     120    <Content Include="Map.txt"> 
     121      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
     122    </Content> 
    126123  </ItemGroup> 
    127124  <ItemGroup> 
     
    152149    </BootstrapperPackage> 
    153150  </ItemGroup> 
     151  <ItemGroup> 
     152    <ProjectReference Include="..\SFN-säätöäContent\SFN-säätöäContent.contentproj"> 
     153      <Project>{6E4FF9F9-285D-4DD8-891A-57C2EB3CEE58}</Project> 
     154      <Name>SFN-säätöäContent %28Content%29</Name> 
     155      <XnaReferenceType>Content</XnaReferenceType> 
     156    </ProjectReference> 
     157  </ItemGroup> 
    154158  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 
    155159  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" /> 
  • 2011/26/LinusV/SFN/SFN-säätöä/SFN-säätöä/SFN-säätöä/obj/x86/Debug/SFN-säätöä.csproj.FileListAbsolute.txt

    r2178 r2237  
    77C:\Users\Linus\Ohjelmointi\SpeedForNeed\SFN\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\obj\x86\Debug\SFN-sÀÀtöÀ.exe 
    88C:\Users\Linus\Ohjelmointi\SpeedForNeed\SFN\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\obj\x86\Debug\SFN-sÀÀtöÀ.pdb 
     9C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\SFN-sÀÀtöÀ.exe 
     10C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\SFN-sÀÀtöÀ.pdb 
     11C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\Jypeli4.dll 
     12C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\Jypeli4.xml 
     13C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\obj\x86\Debug\ResolveAssemblyReference.cache 
     14C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\obj\x86\Debug\Microsoft.Xna.Framework.RuntimeProfile.txt 
     15C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\obj\x86\Debug\SFN-sÀÀtöÀ.exe 
     16C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\obj\x86\Debug\SFN-sÀÀtöÀ.pdb 
     17C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\Content\MenuBackround.xnb 
     18C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\Content\Sporttinen2.xnb 
     19C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\Content\Talo1.xnb 
     20C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\Content\Talo2.xnb 
     21C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\Content\Talo3.xnb 
     22C:\MyTemp\LinusV\SFN\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\SFN-sÀÀtöÀ\bin\x86\Debug\Map.txt 
  • 2011/26/LinusV/SFN/SFN-säätöä/SFN-säätöä/SFN-säätöäContent/SFN-säätöäContent.contentproj

    r2169 r2237  
    4242    </Reference> 
    4343  </ItemGroup> 
     44  <ItemGroup> 
     45    <Compile Include="MenuBackround.png"> 
     46      <Name>MenuBackround</Name> 
     47      <Importer>TextureImporter</Importer> 
     48      <Processor>TextureProcessor</Processor> 
     49    </Compile> 
     50  </ItemGroup> 
     51  <ItemGroup> 
     52    <Compile Include="Sporttinen2.png"> 
     53      <Name>Sporttinen2</Name> 
     54      <Importer>TextureImporter</Importer> 
     55      <Processor>TextureProcessor</Processor> 
     56    </Compile> 
     57  </ItemGroup> 
     58  <ItemGroup> 
     59    <Compile Include="Talo1.png"> 
     60      <Name>Talo1</Name> 
     61      <Importer>TextureImporter</Importer> 
     62      <Processor>TextureProcessor</Processor> 
     63    </Compile> 
     64    <Compile Include="Talo2.png"> 
     65      <Name>Talo2</Name> 
     66      <Importer>TextureImporter</Importer> 
     67      <Processor>TextureProcessor</Processor> 
     68    </Compile> 
     69    <Compile Include="Talo3.png"> 
     70      <Name>Talo3</Name> 
     71      <Importer>TextureImporter</Importer> 
     72      <Processor>TextureProcessor</Processor> 
     73    </Compile> 
     74  </ItemGroup> 
    4475  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    4576  <!--  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.