Changeset 2559 for 2011/31


Ignore:
Timestamp:
2011-08-04 14:59:09 (8 years ago)
Author:
alnirham
Message:

Talletus.

Location:
2011/31/AleksiN
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2011/31/AleksiN/workingtitle/workingtitle/Peli.cs

    r2524 r2559  
    1111    Vector hyppynopeus = new Vector(0, 550); 
    1212    Vector nopeus = new Vector(800, 0); 
     13    Vector boost = new Vector(1500, 0); 
    1314     
    1415    PhysicsObject ukko; 
     
    1718    PhysicsObject punpalikka; 
    1819 
    19     Image reuna = LoadImage ("palikka"); 
     20    int kenttanro = 1; 
     21 
    2022    Image peruna = LoadImage("peruna"); 
     23    Image portal1 = LoadImage("portal1"); 
    2124 
    2225    public override void Begin() 
     
    2629        hahmot(); 
    2730        kontrollit(); 
    28         reunat(); 
    29         kentta(); 
    3031 
    3132        Camera.Follow(ukko); 
    3233 
    33         Level.BackgroundColor = new Color(30, 30, 80); 
     34        if (kenttanro == 1) 
     35        { 
     36            kentta1(); 
     37        } 
     38        if (kenttanro == 2) 
     39        { 
     40            kentta2(); 
     41        } 
    3442 
    3543    } 
     
    4048        ukko.Shape = Shape.Circle; 
    4149        ukko.Color = Color.LimeGreen; 
    42         //ukko.Image = LoadImage ("peruna"); 
     50        ukko.Image = LoadImage ("peruna"); 
    4351        ukko.KineticFriction = 0.7; 
    4452        ukko.Restitution = 0.15; 
    4553        ukko.X = -875.0; 
    4654        ukko.Y = 275.0; 
     55        AddCollisionHandler(ukko, boostcollisionhandler); 
    4756        AddCollisionHandler(ukko, kuolema); 
     57        AddCollisionHandler(ukko, seuraavakentta); 
    4858         
    4959        Add(ukko); 
    5060    } 
    5161 
    52     void reunat() 
     62    void kentta1() 
     63    { 
     64        kentta1reunat(); 
     65        kentta1palikat(); 
     66 
     67        Level.BackgroundColor = new Color(30, 30, 80); 
     68    } 
     69 
     70    void kentta2() 
     71    { 
     72        ukko.Width = 42; 
     73        ukko.Height = 42; 
     74 
     75        kentta2reunat(); 
     76        kentta2palikat(); 
     77 
     78        ukko.X = -1260; 
     79        ukko.Y = 250; 
     80 
     81        Level.BackgroundColor = new Color(95,70,0); 
     82    } 
     83 
     84    void kentta2reunat() 
     85    { 
     86        PhysicsObject alareuna = PhysicsObject.CreateStaticObject(8000, 500); 
     87        alareuna.Y = -575; 
     88        alareuna.IgnoresGravity = true; 
     89        alareuna.Color = new Color(255, 190, 0); 
     90        Add(alareuna); 
     91 
     92        PhysicsObject ylareuna = PhysicsObject.CreateStaticObject(8000, 500); 
     93        ylareuna.Y = 575; 
     94        ylareuna.IgnoresGravity = true; 
     95        ylareuna.Color = new Color(255, 190, 0); 
     96        Add(ylareuna); 
     97 
     98        PhysicsObject vasenreuna = PhysicsObject.CreateStaticObject(750, 1750); 
     99        vasenreuna.X = -1775; 
     100        vasenreuna.IgnoresGravity = true; 
     101        vasenreuna.Color = new Color(255, 190, 0); 
     102        Add(vasenreuna); 
     103 
     104        PhysicsObject oikeareuna = PhysicsObject.CreateStaticObject(750, 1750); 
     105        oikeareuna.X = 4000; 
     106        oikeareuna.IgnoresGravity = true; 
     107        oikeareuna.Color = new Color(255, 190, 0); 
     108        Add(oikeareuna); 
     109    } 
     110 
     111    void kentta2palikat() 
     112    { 
     113        palikka = palikat2(-1260, 195, 125, 30, Angle.FromDegrees(0)); 
     114        palikka = palikat2(-1200, 280, 30, 200, Angle.FromDegrees(0)); 
     115        palikka = palikat2(-1350, -10, 250, 30, Angle.FromDegrees(-50)); 
     116        palikka = palikat2(-1180, -170, 250, 30, Angle.FromDegrees(-35)); 
     117        palikka = palikat2(-970, -280, 250, 30, Angle.FromDegrees(-20)); 
     118        palikka = palikat2(-450, -310, 250, 30, Angle.FromDegrees(15)); 
     119        palikka = palikat2(-220, -228, 250, 30, Angle.FromDegrees(25)); 
     120 
     121        PhysicsObject boost = new PhysicsObject(10, 10); 
     122        Add(boost); 
     123    } 
     124 
     125    void kentta1reunat() 
    53126    { 
    54127 
     
    56129        alareuna.Y = -575; 
    57130        alareuna.IgnoresGravity = true; 
    58         alareuna.Image = reuna; 
     131        alareuna.Color = new Color(0, 215, 215); 
    59132        Add(alareuna); 
    60133 
     
    62135        ylareuna.Y = 575; 
    63136        ylareuna.IgnoresGravity = true; 
    64         ylareuna.Image = reuna; 
     137        ylareuna.Color = new Color(0, 215, 215); 
    65138        Add(ylareuna); 
    66139 
     
    68141        vasenreuna.X = -1775; 
    69142        vasenreuna.IgnoresGravity = true; 
    70         vasenreuna.Image = reuna; 
     143        vasenreuna.Color = new Color(0, 215, 215); 
    71144        Add(vasenreuna); 
    72145 
     
    74147        oikeareuna.X = 1775; 
    75148        oikeareuna.IgnoresGravity = true; 
    76         oikeareuna.Image = reuna; 
     149        oikeareuna.Color = new Color(0, 215, 215); 
    77150        Add(oikeareuna); 
    78151    } 
    79152 
    80     void kentta() 
    81     { 
    82         palikka = palikat(-805.0, 300.0, 50, 1050); 
    83         palikka = palikat(-775.0, -210.0, 80, 30); 
    84         palikka = palikat(-775.0, -90.0, 60, 30); 
    85         palikka = palikat(-775.0, 30.0, 40, 30); 
    86         palikka = palikat(-380.0, 150.0, 60, 750); 
    87         palikka = palikat(-240.0, -190.0, 28, 20); 
    88         palikka = palikat(-140.0, -60.0, 28, 20); 
    89         palikka = palikat(-40.0, 70.0, 28, 20); 
    90         palikka = palikat(-276.0, 170.0, 250, 30); 
    91         palikka = palikat(150.0, 260.0, 500, 20); 
    92         palikka = palikat(70, -33, 30, 605); 
    93         palikka = palikat(-1050, 220, 450, 30); 
    94         punpalikka = punpalikat(-625.0, -78.0, 60, 490); 
    95         punpalikka = punpalikat(-600.0, -150.0, 100, 50); 
    96         punpalikka = punpalikat(-435.0, -150.0, 50, 50); 
    97         punpalikka = punpalikat(-98.0, -315.0, 305, 20); 
    98         punpalikka = punpalikat(-285.0, 255.0, 130, 139); 
    99     } 
    100  
    101     PhysicsObject palikat(double x, double y, double width, double height) 
    102     { 
    103         PhysicsObject palikka = PhysicsObject.CreateStaticObject(100.0,100.0); 
    104         palikka.Image = reuna; 
     153    void kentta1palikat() 
     154    { 
     155        palikka = palikat(-805.0, 300.0, 50, 1050, Angle.FromDegrees (0)); 
     156        palikka = palikat(-775.0, -210.0, 80, 30, Angle.FromDegrees(0)); 
     157        palikka = palikat(-775.0, -90.0, 60, 30, Angle.FromDegrees(0)); 
     158        palikka = palikat(-775.0, 30.0, 40, 30, Angle.FromDegrees(0)); 
     159        palikka = palikat(-380.0, 150.0, 60, 750, Angle.FromDegrees(0)); 
     160        palikka = palikat(-240.0, -190.0, 28, 20, Angle.FromDegrees(0)); 
     161        palikka = palikat(-140.0, -60.0, 28, 20, Angle.FromDegrees(0)); 
     162        palikka = palikat(-40.0, 70.0, 28, 20, Angle.FromDegrees(0)); 
     163        palikka = palikat(-276.0, 170.0, 250, 30, Angle.FromDegrees(0)); 
     164        palikka = palikat(200.0, 260.0, 600, 20, Angle.FromDegrees(0)); 
     165        palikka = palikat(70, -33, 30, 605, Angle.FromDegrees(0)); 
     166        palikka = palikat(-1050, 220, 450, 30, Angle.FromDegrees(0)); 
     167        palikka = palikat(-655.0, -298.0, 15, 55, Angle.FromDegrees(0)); 
     168        palikka = palikat(600.0, 50, 60, 600, Angle.FromDegrees(0)); 
     169        palikka = palikat(565.0, 60.0, 40, 20, Angle.FromDegrees(0)); 
     170        palikka = palikat(280.0, 155.0, 220, 20, Angle.FromDegrees(0)); 
     171        palikka = palikat(380, 93, 20, 123, Angle.FromDegrees(0)); 
     172        palikka = palikat(160, -100, 250, 30, Angle.FromDegrees(-45)); 
     173        palikka = palikat(505, -180, 200, 30, Angle.FromDegrees(40)); 
     174        palikka = palikat(-1330, 0, 230, 30, Angle.FromDegrees(-45)); 
     175        palikka = palikat(-1000, -250, 30, 420, Angle.FromDegrees(0)); 
     176        palikka = palikat(1295, -50, 60, 585, Angle.FromDegrees(0)); 
     177        palikka = palikat(730, -210, 35, 30, Angle.FromDegrees(0)); 
     178        palikka = palikat(880, -210, 35, 30, Angle.FromDegrees(0)); 
     179        palikka = palikat(1030, -210, 35, 30, Angle.FromDegrees(0)); 
     180        palikka = palikat(1180, -210, 35, 30, Angle.FromDegrees(0)); 
     181        palikka = palikat(1250, -135, 35, 30, Angle.FromDegrees(0)); 
     182        palikka = palikat(1105, -30, 35, 30, Angle.FromDegrees(0)); 
     183        palikka = palikat(955, -30, 35, 30, Angle.FromDegrees(0)); 
     184        palikka = palikat(805, -30, 35, 30, Angle.FromDegrees(0)); 
     185        palikka = palikat(640, 55, 35, 30, Angle.FromDegrees(0)); 
     186        palikka = palikat(730, 140, 35, 30, Angle.FromDegrees(0)); 
     187        palikka = palikat(880, 140, 35, 30, Angle.FromDegrees(0)); 
     188        palikka = palikat(1030, 140, 35, 30, Angle.FromDegrees(0)); 
     189        palikka = palikat(1180, 140, 35, 30, Angle.FromDegrees(0)); 
     190        punpalikka = punpalikat(-625.0, -80.0, 60, 492, Angle.FromDegrees(0)); 
     191        punpalikka = punpalikat(-600.0, -150.0, 100, 50, Angle.FromDegrees(0)); 
     192        punpalikka = punpalikat(-435.0, -150.0, 50, 50, Angle.FromDegrees(0)); 
     193        punpalikka = punpalikat(-98.0, -315.0, 305, 20, Angle.FromDegrees(0)); 
     194        punpalikka = punpalikat(-285.0, 255.0, 130, 139, Angle.FromDegrees(0)); 
     195        punpalikka = punpalikat(480, 40, 180, 20, Angle.FromDegrees(0)); 
     196        punpalikka = punpalikat(326, -139, 155, 30, Angle.FromDegrees(40)); 
     197        punpalikka = punpalikat(-1140, -312, 250, 30, Angle.FromDegrees(0)); 
     198        punpalikka = punpalikat(274, -253, 30, 144, Angle.FromDegrees(0)); 
     199        punpalikka = punpalikat(984, -315, 562, 20, Angle.FromDegrees(0)); 
     200 
     201        PhysicsObject maali = PhysicsObject.CreateStaticObject(30, 50); 
     202        maali.Shape = Shape.Circle; 
     203        maali.X = 1363; 
     204        maali.Y = -300; 
     205        maali.Angle = Angle.FromDegrees(-15); 
     206        maali.Tag = "maali"; 
     207        maali.Image = LoadImage("portal1"); 
     208        Add(maali); 
     209 
     210        PhysicsObject test = PhysicsObject.CreateStaticObject(30, 50); 
     211        test.Shape = Shape.Circle; 
     212        test.X = -950; 
     213        test.Y = 275; 
     214        test.Angle = Angle.FromDegrees(-15); 
     215        test.Tag = "maali"; 
     216        test.Image = LoadImage("portal1"); 
     217        Add(test); 
     218    } 
     219 
     220    PhysicsObject palikat(double x, double y, double width, double height, Angle kulma) 
     221    { 
     222        PhysicsObject palikka = PhysicsObject.CreateStaticObject(100.0, 100.0); 
     223        palikka.Color = new Color(0,215,215); 
    105224        palikka.X = x; 
    106225        palikka.Y = y; 
    107226        palikka.Width = width; 
    108227        palikka.Height = height; 
     228        palikka.Angle = kulma; 
    109229        Add(palikka); 
    110230 
    111231        return palikka; 
    112232    } 
    113     PhysicsObject punpalikat(double x, double y, double width, double height) 
     233 
     234        PhysicsObject palikat2(double x, double y, double width, double height, Angle kulma) 
     235    { 
     236        PhysicsObject palikka = PhysicsObject.CreateStaticObject(100.0,100.0); 
     237        palikka.Color = new Color(255,190,0); 
     238        palikka.X = x; 
     239        palikka.Y = y; 
     240        palikka.Width = width; 
     241        palikka.Height = height; 
     242        palikka.Angle = kulma; 
     243        Add(palikka); 
     244 
     245        return palikka; 
     246    } 
     247    PhysicsObject punpalikat(double x, double y, double width, double height, Angle kulma) 
    114248    { 
    115249        PhysicsObject punpalikka = PhysicsObject.CreateStaticObject(100.0,100.0); 
     
    119253        punpalikka.Width = width; 
    120254        punpalikka.Height = height; 
     255        punpalikka.Angle = kulma; 
    121256        punpalikka.Tag = "punpalikka"; 
    122257        Add(punpalikka); 
     
    129264        if (kohde.Tag.ToString() == "punpalikka") 
    130265        { 
    131             //ukko.Position = (-880, 295); 
    132             ukko.X = -880; 
     266            ukko.X = -875; 
    133267            ukko.Y = 295; 
     268        } 
     269    } 
     270 
     271    void seuraavakentta(PhysicsObject ukko, PhysicsObject kohde) 
     272    { 
     273        if (kohde.Tag.ToString() == "maali") 
     274        { 
     275            kenttanro++; 
     276            ClearAll(); 
     277            Begin(); 
     278        } 
     279    } 
     280 
     281    void boostcollisionhandler(PhysicsObject ukko, PhysicsObject kohde) 
     282    { 
     283        if (kohde.Tag.ToString() == "boost") 
     284        { 
     285            boosttapahtuma; 
    134286        } 
    135287    } 
     
    152304    void hyppaa(PhysicsObject ukko, Vector hyppynopeus) 
    153305    { 
    154          
    155         ukko.Hit(hyppynopeus); 
    156     } 
    157  
     306 
     307        //if (ukko.Velocity.Y == 0) 
     308        //{ 
     309            ukko.Hit(hyppynopeus); 
     310        //} 
     311    } 
     312 
     313    void boosttapahtuma(PhysicsObject ukko, Vector boost) 
     314    { 
     315        ukko.Push(boost); 
     316    } 
    158317} 
  • 2011/31/AleksiN/workingtitle/workingtitleContent/workingtitleContent.contentproj

    r2524 r2559  
    4545  </ItemGroup> 
    4646  <ItemGroup> 
    47     <Compile Include="tausta.PNG"> 
    48       <Name>tausta</Name> 
     47    <Compile Include="peruna.PNG"> 
     48      <Name>peruna</Name> 
    4949      <Importer>TextureImporter</Importer> 
    5050      <Processor>TextureProcessor</Processor> 
     
    5252  </ItemGroup> 
    5353  <ItemGroup> 
    54     <Compile Include="palikka.PNG"> 
    55       <Name>palikka</Name> 
    56       <Importer>TextureImporter</Importer> 
    57       <Processor>TextureProcessor</Processor> 
    58     </Compile> 
    59   </ItemGroup> 
    60   <ItemGroup> 
    61     <Compile Include="punpalikka.PNG"> 
    62       <Name>punpalikka</Name> 
    63       <Importer>TextureImporter</Importer> 
    64       <Processor>TextureProcessor</Processor> 
    65     </Compile> 
    66   </ItemGroup> 
    67   <ItemGroup> 
    68     <Compile Include="peruna.PNG"> 
    69       <Name>peruna</Name> 
     54    <Compile Include="portal1.png"> 
     55      <Name>portal1</Name> 
    7056      <Importer>TextureImporter</Importer> 
    7157      <Processor>TextureProcessor</Processor> 
Note: See TracChangeset for help on using the changeset viewer.