Changeset 5224


Ignore:
Timestamp:
2014-07-01 13:37:29 (5 years ago)
Author:
mijoilmo
Message:

vähän kaikkea
player omassa luokassansa

Location:
2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor
Files:
9 added
12 edited

Legend:

Unmodified
Added
Removed
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor.cs

    r5218 r5224  
    77using Jypeli.Widgets; 
    88 
     9 
     10 
    911public class Proto236b : PhysicsGame //true survivor 
    1012{ 
    11     Image[] images = new Image[1]; 
     13    Player player; 
     14    static public Dictionary<string, Image> images = new Dictionary<string, Image>(); 
    1215    void AssignKeys() 
    1316    { 
    1417        Keyboard.Listen(Key.Escape, ButtonState.Down, Exit, "Lopeta Peli"); 
     18        Keyboard.Listen(Key.Up, ButtonState.Down, player.throttle, "Lento"); 
    1519    } 
    1620    void LoadAllImages() 
    1721    { 
    18         images[0] = LoadImage("graphics/backgrounds/space_background"); 
     22        images["background0"] = LoadImage("graphics/backgrounds/space_background"); 
     23        images["player"] = LoadImage("graphics/ships/player"); 
     24        images["tile0"] = LoadImage("graphics/tiles/tile0.png"); 
    1925    } 
    2026    void LoadLevel(int level) 
    2127    { 
    2228        ClearAll(); 
     29        Add(this.player); 
    2330        AssignKeys(); 
    2431        LevelFromImage("graphics/levels/" + level); 
     
    2734    { 
    2835        ColorTileMap tileMap = ColorTileMap.FromLevelAsset(levelName); 
    29         tileMap.SetTileMethod(Color.FromHexCode("000000"), createTile, "seina"); 
    30         tileMap.Execute(); 
     36        tileMap.SetTileMethod(Color.FromHexCode("000000"), createTile, ""); 
     37        tileMap.SetTileMethod(Color.FromHexCode("ff0000"), spawnPlayer); 
     38        tileMap.Execute(20,20); 
    3139    } 
    32     void createTile(Vector position, double w, double h, string type) 
     40    void createTile(Vector position, double w, double h, string id) 
    3341    { 
    34  
     42        MikonPhysicsObject tile = new MikonPhysicsObject(this, w, h); 
     43        tile.MakeStatic(); 
     44        tile.Position = position; 
     45        if (id != "") 
     46        { 
     47            tile.Image = images[id]; 
     48        } 
     49        Add(tile); 
     50    } 
     51    void spawnPlayer(Vector position, double w, double h) 
     52    { 
     53        player.Position = position; 
    3554    } 
    3655    public override void Begin() 
     
    3857        // TODO: Kirjoita peli tähän 
    3958        LoadAllImages(); 
     59        this.player = new Player(); 
    4060        LoadLevel(0); 
    4161    } 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor.csproj

    r5213 r5224  
    111111  </ItemGroup> 
    112112  <ItemGroup> 
     113    <Compile Include="MikonPhysicsObject.cs" /> 
    113114    <Compile Include="Ohjelma.cs" /> 
     115    <Compile Include="Player.cs" /> 
    114116    <Compile Include="Protokolla236TrueSurvivor.cs" /> 
    115117    <Compile Include="Properties\AssemblyInfo.cs" /> 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor.csproj.Debug.cachefile

    r5218 r5224  
    11Content\graphics\backgrounds\space_background.xnb 
    22Content\graphics\levels\0.xnb 
     3Content\graphics\ships\player.xnb 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/obj/x86/Debug/ContentPipeline-{5156C658-EF8C-4216-BA6D-9928D133FE72}.xml

    r5220 r5224  
    1919      <Output>C:\MyTemp\AleksanteriV\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\levels\0.xnb</Output> 
    2020      <Time>2014-07-01T12:28:07.7470428+03:00</Time> 
     21    </Item> 
     22    <Item> 
     23      <Source>graphics\ships\player.png</Source> 
     24      <Name>graphics\ships\player</Name> 
     25      <Importer>TextureImporter</Importer> 
     26      <Processor>TextureProcessor</Processor> 
     27      <Options>None</Options> 
     28      <Output>C:\MyTemp\AleksanteriV\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\ships\player.xnb</Output> 
     29      <Time>2014-07-01T12:37:39.845633+03:00</Time> 
    2130    </Item> 
    2231    <BuildSuccessful>true</BuildSuccessful> 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/obj/x86/Debug/Protokolla236TrueSurvivor.csproj.FileListAbsolute.txt

    r5218 r5224  
    99C:\MyTemp\AleksanteriV\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\backgrounds\space_background.xnb 
    1010C:\MyTemp\AleksanteriV\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\levels\0.xnb 
     11C:\MyTemp\AleksanteriV\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\Protokolla236TrueSurvivor\bin\x86\Debug\Content\graphics\ships\player.xnb 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/obj/x86/Debug/cachefile-{5156C658-EF8C-4216-BA6D-9928D133FE72}-targetpath.txt

    r5218 r5224  
    11Content\graphics\backgrounds\space_background.xnb 
    22Content\graphics\levels\0.xnb 
     3Content\graphics\ships\player.xnb 
  • 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivorContent/Protokolla236TrueSurvivorContent.contentproj

    r5218 r5224  
    4545    <Reference Include="AnimationExtension" /> 
    4646  </ItemGroup> 
    47   <ItemGroup /> 
    4847  <ItemGroup> 
    4948    <Compile Include="graphics\backgrounds\space_background.png"> 
     
    6059    </Compile> 
    6160  </ItemGroup> 
     61  <ItemGroup> 
     62    <Compile Include="graphics\ships\player.png"> 
     63      <Name>player</Name> 
     64      <Importer>TextureImporter</Importer> 
     65      <Processor>TextureProcessor</Processor> 
     66    </Compile> 
     67  </ItemGroup> 
     68  <ItemGroup> 
     69    <Folder Include="graphics\stations\" /> 
     70  </ItemGroup> 
    6271  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    6372  <!--  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.