Changeset 3774


Ignore:
Timestamp:
2012-07-26 15:01:55 (11 years ago)
Author:
juiitamm
Message:

Talletus.

Location:
2012/30/TuomasW/Mortal Rally/Mortal Rally
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2012/30/TuomasW/Mortal Rally/Mortal Rally/Mortal Rally/Mortal_Rally.cs

    r3745 r3774  
    77using Jypeli.Widgets; 
    88 
    9 public class Mortal_Rally : TopDownPhysicsGame 
     9public class Mortal_Rally : TopDownPhysicsGame  //actually is dolan 
    1010{ 
    1111     
    1212 
     13    //saatanan saatanan saatana 
     14 
    1315    Image taustaKuva = LoadImage("rata"); 
    14  
     16                                                                             
    1517 
    1618    Automobile auto; 
    1719    Automobile auto2; 
    1820 
    19     public override void Begin() 
     21    public override void Begin() //äxschly is dlan 
    2022    { 
     23 
     24        LuoKenttä(); 
     25 
     26         
     27 
    2128        Level.CreateBorders(1, true); 
    2229        Camera.ZoomToLevel(); 
     
    2431        Level.Background.Image = taustaKuva; 
    2532        Level.BackgroundColor = Color.Green; 
     33        Level.Background.FitToLevel(); 
    2634 
    2735        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
     
    2937 
    3038 
     39 
    3140        //PhysicsObject aita = new PhysicsObject(LoadImage("aidat")); 
    3241        //Add(aita); 
     42        
     43       auto = LuoAuto(-50, -1300); 
     44       auto.Image = LoadImage("auto1"); 
    3345 
     46       auto2 = LuoAuto(-50, 1100); 
     47       auto2.Image = LoadImage("auto2"); 
    3448 
    35        auto = LuoAuto(Level.Left + 20, 0); 
    36        auto2 = LuoAuto(Level.Right - 20, 0); 
     49       AddCollisionHandler(auto, auto2, AutoHajoaa); 
     50       AddCollisionHandler(auto2, auto, Auto2Hajoaa); 
    3751 
    38         Keyboard.Listen(Key.Up, ButtonState.Down, liikutaAutoa, "liikuta", auto); 
    39         Keyboard.Listen(Key.Down, ButtonState.Down, liikutaAutoa, "liikuta", auto); 
    40         Keyboard.Listen(Key.Left, ButtonState.Down, Kaanny, "Kääntyy", Angle.FromDegrees(4), auto); 
    41         Keyboard.Listen(Key.Right, ButtonState.Down, Kaanny, "Kääntyy", Angle.FromDegrees(-4), auto); 
     52       Keyboard.Listen(Key.Up, ButtonState.Down, liikutaAutoa, "liikuta", auto); 
     53       Keyboard.Listen(Key.Down, ButtonState.Down, jarruta, "jarruttaa", auto); 
     54       //Keyboard.Listen(Key.Down, ButtonState.Released, , "liikuta", auto); 
     55       Keyboard.Listen(Key.Left, ButtonState.Down, Kaanny, "Kääntyy", Angle.FromDegrees(1.5), auto); 
     56       Keyboard.Listen(Key.Right, ButtonState.Down, Kaanny, "Kääntyy", Angle.FromDegrees(-1.5), auto); 
    4257 
    43         Keyboard.Listen(Key.W, ButtonState.Down, liikutaAutoa, "liikuta", auto2); 
    44         Keyboard.Listen(Key.S, ButtonState.Down, liikutaAutoa, "liikuta", auto2); 
    45         Keyboard.Listen(Key.A, ButtonState.Down, Kaanny, "Kääntyy", Angle.FromDegrees(4), auto2); 
    46         Keyboard.Listen(Key.D, ButtonState.Down, Kaanny, "Kääntyy", Angle.FromDegrees(-4), auto2); 
     58       Keyboard.Listen(Key.W, ButtonState.Down, liikutaAutoa, "liikuta", auto2); 
     59       Keyboard.Listen(Key.S, ButtonState.Down, jarruta, "jarruttaa", auto2); 
     60       Keyboard.Listen(Key.A, ButtonState.Down, Kaanny, "Kääntyy", Angle.FromDegrees(1.5), auto2); 
     61       Keyboard.Listen(Key.D, ButtonState.Down, Kaanny, "Kääntyy", Angle.FromDegrees(-1.5), auto2); 
    4762    } 
    4863 
    49     Automobile LuoAuto(double x, double y) 
     64    Automobile LuoAuto(double x, double y) //ask about free shipping! 
    5065    { 
    5166 
    5267 
    53         Automobile auto = new Automobile(27.5, 45); 
    54         auto.Shape = Shape.Rectangle; 
    55         auto.X = x; 
    56         auto.Y = y; 
    57         auto.Restitution = 0.5; 
    58         Add(auto); 
    59         return auto; 
     68       Automobile auto = new Automobile(150, 130); 
     69       auto.Shape = Shape.Rectangle; 
     70       //auto.Image = LoadImage("auto1"); 
     71       auto.X = x; 
     72       auto.Y = y; 
     73       auto.Restitution = 0.5; 
     74       //auto.MaxVelocity = 100; 
     75       auto.Acceleration = 300.0; 
     76       auto.AngularDamping = 0.01; 
     77       auto.LinearDamping = 0.992; 
     78       Add(auto); 
     79       return auto; 
     80 
     81    } 
     82        //saatanan saatanan SAATANA  
    6083 
    6184 
     85     void LuoKenttä() 
     86    { 
     87         ColorTileMap ruudut = ColorTileMap.FromLevelAsset("aidat_pieni"); 
    6288 
     89         ruudut.SetTileMethod(Color.Black, LuoAidat); 
    6390 
     91         ruudut.Execute(48, 64); 
    6492 
    6593    } 
     94 
     95    //kenttä on paras :D ja aidat:DD 
     96 
     97     void LuoAidat(Vector paikka, double korkeus, double leveys) 
     98     { 
     99         PhysicsObject aidat = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     100         aidat.Position = paikka; 
     101         aidat.Color = Color.OrangeRed; 
     102         // aidat.Image =  
     103         Add(aidat); 
     104     } 
    66105 
    67106    void Kaanny (Angle kulma, Automobile auto) 
     
    72111    void liikutaAutoa(Automobile auto) 
    73112    { 
    74         auto.Accelerate(1); 
    75         auto.LinearDamping = 0.99; 
    76         auto.AngularDamping = 0.99; 
     113        auto.Accelerate(); 
     114     } 
     115 
     116    void jarruta(Automobile auto) 
     117    { 
     118        auto.Brake(); 
    77119    } 
    78120 
     
    87129    } 
    88130 
     131    void AutoHajoaa(PhysicsObject auto, PhysicsObject auto2) 
     132    { 
     133        if (auto.Velocity.Magnitude > 100)  
     134        { 
     135            auto2.Destroy(); 
     136        } 
     137    } 
     138 
     139    void Auto2Hajoaa(PhysicsObject auto2, PhysicsObject auto) 
     140    { 
     141        if (auto2.Velocity.Magnitude > 100) 
     142        { 
     143            auto.Destroy(); 
     144        } 
     145    } 
     146 
     147 
     148 
     149    
    89150 
    90151} 
     152 
     153    //NOW GET OUT OF MY HOUSE! 
  • 2012/30/TuomasW/Mortal Rally/Mortal Rally/Mortal RallyContent/Mortal RallyContent.contentproj

    r3745 r3774  
    6565    </Compile> 
    6666  </ItemGroup> 
     67  <ItemGroup> 
     68    <Compile Include="aidat_pieni.png"> 
     69      <Name>aidat_pieni</Name> 
     70      <Importer>TextureImporter</Importer> 
     71      <Processor>TextureProcessor</Processor> 
     72    </Compile> 
     73  </ItemGroup> 
     74  <ItemGroup> 
     75    <Compile Include="auto1.png"> 
     76      <Name>auto1</Name> 
     77      <Importer>TextureImporter</Importer> 
     78      <Processor>TextureProcessor</Processor> 
     79    </Compile> 
     80  </ItemGroup> 
     81  <ItemGroup> 
     82    <Compile Include="auto2.png"> 
     83      <Name>auto2</Name> 
     84      <Importer>TextureImporter</Importer> 
     85      <Processor>TextureProcessor</Processor> 
     86    </Compile> 
     87  </ItemGroup> 
    6788  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6889  <!--  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.