Changeset 4079


Ignore:
Timestamp:
2013-06-11 15:02:20 (10 years ago)
Author:
alvirmas
Message:

Talletus.

Location:
2013/24/AleksanteriV/Protokolla236/Protokolla236
Files:
12 added
4 edited

Legend:

Unmodified
Added
Removed
  • 2013/24/AleksanteriV/Protokolla236/Protokolla236/Protokolla236/Protokolla236.cs

    r4059 r4079  
    1010{ 
    1111    private Image[] tasoanim = LoadImages("taso1", "taso1.1", "taso1.2", "taso1.3", "taso1", "taso1", "taso1.3", "taso1", "taso1.1"); 
    12  
     12    private Image[] liekkianim = LoadImages("liekki1.1","liekki1.2"); 
     13    Image tausta = LoadImage("tausta01"); 
     14    Image pelaajankuva = LoadImage("pelaaja1.0"); 
     15    Image taso2 = LoadImage("taso2"); 
     16    Image taso3 = LoadImage("taso3"); 
     17    Image taso4 = LoadImage("taso4"); 
     18    private Image[] tasoliekkianim = LoadImages("taso23.1","taso23.2","taso23.3"); 
     19    private Image[] Blockanim = LoadImages("Block1.1","Block1.2","Block1.3","Block1.2"); 
    1320    public override void Begin() 
    1421    { 
    1522 
    1623 
     24        luokentta(); 
    1725 
     26        Gravity = new Vector(0.0, -200.0); 
     27         
     28         
     29         
     30         
    1831 
    19  
    20  
    21         luokentta(); 
    22          
    2332 
    2433        PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
     
    2736    void luokentta() 
    2837    { 
    29         ColorTileMap ruudut = ColorTileMap.FromLevelAsset("kentta1"); 
     38        ColorTileMap ruudut = ColorTileMap.FromLevelAsset("kentta2"); 
    3039 
    3140        ruudut.SetTileMethod(Color.FromHexCode("00FF00"), luopelaaja); 
    32         ruudut.SetTileMethod(Color.FromHexCode("000000"), luotaso); 
    33         ruudut.SetTileMethod(Color.FromHexCode("000000"), luotaso2); 
     41        ruudut.SetTileMethod(Color.FromHexCode("000000"), luotaso, new Animation(tasoliekkianim)); 
     42        ruudut.SetTileMethod(Color.FromHexCode("FFFF00"), luotaso, (Animation)taso3); 
     43        ruudut.SetTileMethod(Color.FromHexCode("54FFEB"), luotaso, (Animation)taso4); 
     44        ruudut.SetTileMethod(Color.FromHexCode("0000FF"), luotaso, new Animation(tasoanim)); 
     45        ruudut.SetTileMethod(Color.FromHexCode("FF42C0"), luotausta, new Animation(Blockanim)); 
    3446        ruudut.Execute(50, 50); 
     47    } 
     48 
     49    void luotaso(Vector paikka, double leveys, double korkeus, Animation kuva) 
     50    { 
     51        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     52        taso.Position = paikka; 
     53         
     54        Add(taso); 
     55        taso.Animation = kuva; 
     56        taso.Animation.Start(); 
     57        taso.Animation.FPS = RandomGen.NextDouble(3.0, 7.0); 
     58    } 
     59 
     60    void luotausta(Vector paikka, double leveys, double korkeus, Animation kuva) 
     61    { 
     62        GameObject Block = new GameObject(50, 50); 
     63        Block.Position = paikka; 
     64        Add(Block); 
     65        Block.Animation = kuva; 
     66        Block.Animation.Start(); 
     67        Block.Animation.FPS = RandomGen.NextDouble(3.0, 7.0); 
    3568    } 
    3669 
     
    4073        pelaaja1.Image = LoadImage("pelaaja1.0"); 
    4174        pelaaja1.Position = paikka; 
    42         Add(pelaaja1); 
    43          
     75        pelaaja1.CanRotate = false; 
     76        Camera.Follow( pelaaja1 ); 
     77        Camera.StayInLevel = true; 
     78        pelaaja1.Shape = Shape.FromImage(pelaajankuva); 
     79        pelaaja1.Tag = "pelaaja"; 
     80        Add(pelaaja1, 1); 
     81 
     82        GameObject liekki = new GameObject(50, 50); 
     83        liekki.Animation = new Animation(liekkianim); 
     84        liekki.IsVisible = false; 
     85        liekki.Animation.Start(); 
     86        pelaaja1.Add(liekki); 
     87        liekki.Y = -25; 
     88 
     89        GameObject tausta1 = new GameObject(Level.Width, Level.Height); 
     90        tausta1.Image = tausta; 
     91        //tausta1.Position = pelaaja1.Position; 
     92        Add(tausta1, -3); 
     93        Layers[-3].RelativeTransition = new Vector(0.5, 0.5); 
     94 
     95 
     96        Keyboard.Listen(Key.Left, ButtonState.Down, 
     97          kaannaPelaajaa, null, 5.0, pelaaja1); 
     98        Keyboard.Listen(Key.Right, ButtonState.Down, 
     99          kaannaPelaajaa, null, -5.0, pelaaja1); 
     100        Keyboard.Listen(Key.Up, ButtonState.Down, 
     101          LiikutaPelaajaa, null, 1000.0, pelaaja1); 
     102        /*Keyboard.Listen(Key.Down, ButtonState.Down, 
     103          LiikutaPelaajaa, null, -1000, pelaaja1);*/ 
     104        //----------------------------------------------------------------- 
     105        Keyboard.Listen(Key.Up, ButtonState.Down, 
     106         liekkianimaatio, null, liekki,true); 
     107        Keyboard.Listen(Key.Up, ButtonState.Released, 
     108         liekkianimaatio, null, liekki,false); 
     109     }  
     110 
     111    void liekkianimaatio(GameObject liekki, bool totuus) 
     112    { 
     113        liekki.IsVisible = totuus; 
     114    } 
     115 
     116    void kaannaPelaajaa(double kulmanopeus, PhysicsObject pelaaja) 
     117    { 
     118        pelaaja.Angle += Angle.FromDegrees(kulmanopeus); 
     119    } 
     120    void LiikutaPelaajaa(double nopeus, PhysicsObject pelaaja1) 
     121    { 
     122        pelaaja1.Push(Vector.FromLengthAndAngle(nopeus, pelaaja1.Angle + Angle.RightAngle)); 
    44123    } 
    45124 
    46125    void luotaso(Vector paikka, double leveys, double korkeus)  
    47126    { 
    48         PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    49         taso.Image = LoadImage("taso1"); 
    50         taso.Position = paikka; 
    51         Add(taso); 
    52         taso.Animation = new Animation(tasoanim); 
    53         taso.Animation.Start(); 
    54         taso.Animation.FPS = 5; 
     127         
    55128    } 
    56129 
    57     void luotaso2(Vector paikka, double leveys, double korkeus)   
    58     { 
    59         PhysicsObject taso2 = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    60130 
    61         taso2.Image = LoadImage(""); 
    62         taso2.Position = paikka; 
    63         Add(taso2); 
    64  
    65  
    66  
    67     } 
    68131} 
  • 2013/24/AleksanteriV/Protokolla236/Protokolla236/Protokolla236Content/Protokolla236Content.contentproj

    r4059 r4079  
    8787    </Compile> 
    8888  </ItemGroup> 
     89  <ItemGroup> 
     90    <Compile Include="taso2.png"> 
     91      <Name>taso2</Name> 
     92      <Importer>TextureImporter</Importer> 
     93      <Processor>TextureProcessor</Processor> 
     94    </Compile> 
     95  </ItemGroup> 
     96  <ItemGroup> 
     97    <Compile Include="taso3.png"> 
     98      <Name>taso3</Name> 
     99      <Importer>TextureImporter</Importer> 
     100      <Processor>TextureProcessor</Processor> 
     101    </Compile> 
     102  </ItemGroup> 
     103  <ItemGroup> 
     104    <Compile Include="liekki1.2.png"> 
     105      <Name>liekki1.2</Name> 
     106      <Importer>TextureImporter</Importer> 
     107      <Processor>TextureProcessor</Processor> 
     108    </Compile> 
     109  </ItemGroup> 
     110  <ItemGroup> 
     111    <Compile Include="liekki1.1.png"> 
     112      <Name>liekki1.1</Name> 
     113      <Importer>TextureImporter</Importer> 
     114      <Processor>TextureProcessor</Processor> 
     115    </Compile> 
     116  </ItemGroup> 
     117  <ItemGroup> 
     118    <Compile Include="tausta01.png"> 
     119      <Name>tausta01</Name> 
     120      <Importer>TextureImporter</Importer> 
     121      <Processor>TextureProcessor</Processor> 
     122    </Compile> 
     123  </ItemGroup> 
     124  <ItemGroup> 
     125    <Compile Include="taso4.png"> 
     126      <Name>taso4</Name> 
     127      <Importer>TextureImporter</Importer> 
     128      <Processor>TextureProcessor</Processor> 
     129    </Compile> 
     130  </ItemGroup> 
     131  <ItemGroup> 
     132    <Compile Include="taso23.3.png"> 
     133      <Name>taso23.3</Name> 
     134      <Importer>TextureImporter</Importer> 
     135      <Processor>TextureProcessor</Processor> 
     136    </Compile> 
     137  </ItemGroup> 
     138  <ItemGroup> 
     139    <Compile Include="taso23.2.png"> 
     140      <Name>taso23.2</Name> 
     141      <Importer>TextureImporter</Importer> 
     142      <Processor>TextureProcessor</Processor> 
     143    </Compile> 
     144  </ItemGroup> 
     145  <ItemGroup> 
     146    <Compile Include="taso23.1.png"> 
     147      <Name>taso23.1</Name> 
     148      <Importer>TextureImporter</Importer> 
     149      <Processor>TextureProcessor</Processor> 
     150    </Compile> 
     151  </ItemGroup> 
     152  <ItemGroup> 
     153    <Compile Include="kentta2.png"> 
     154      <Name>kentta2</Name> 
     155      <Importer>TextureImporter</Importer> 
     156      <Processor>TextureProcessor</Processor> 
     157    </Compile> 
     158  </ItemGroup> 
     159  <ItemGroup> 
     160    <Compile Include="block1.1.png"> 
     161      <Name>block1.1</Name> 
     162      <Importer>TextureImporter</Importer> 
     163      <Processor>TextureProcessor</Processor> 
     164    </Compile> 
     165    <Compile Include="block1.2.png"> 
     166      <Name>block1.2</Name> 
     167      <Importer>TextureImporter</Importer> 
     168      <Processor>TextureProcessor</Processor> 
     169    </Compile> 
     170    <Compile Include="block1.3.png"> 
     171      <Name>block1.3</Name> 
     172      <Importer>TextureImporter</Importer> 
     173      <Processor>TextureProcessor</Processor> 
     174    </Compile> 
     175    <Compile Include="Block2.1.png"> 
     176      <Name>Block2.1</Name> 
     177      <Importer>TextureImporter</Importer> 
     178      <Processor>TextureProcessor</Processor> 
     179    </Compile> 
     180  </ItemGroup> 
    89181  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    90182  <!--  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.