Changeset 6197 for 2015


Ignore:
Timestamp:
2015-06-23 18:18:31 (4 years ago)
Author:
empaheik
Message:

ColorTileMap?-versio

Location:
2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun
Files:
2 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRun.cs

    r6196 r6197  
    4747    { 
    4848        //IntroSequence(); 
    49         MainMenu(); 
     49        //MainMenu(); 
     50        StartGame(); 
    5051    } 
    5152 
     
    113114 
    114115        // Testailen tässä kärryn luomista. 
     116        //double size = 0.7; 
     117        //PhysicsObject cart = new PhysicsObject(400 * size, 80 * size); 
     118        //cart.X = -1600; 
     119        //cart.Y = 200; 
     120        //cart.Image = cartImage; 
     121        //cart.CollisionIgnoreGroup = 2; 
     122        //Add(cart); 
     123        //PhysicsObject cartWheel = new PhysicsObject(160 * size, 160 * size, Shape.Circle); 
     124        //cartWheel.Image = cartWheelImage; 
     125        //cartWheel.Position = cart.Position + new Vector(-110, -30) * size; 
     126        //cartWheel.CollisionIgnoreGroup = 2; 
     127        //Add(cartWheel); 
     128        //AxleJoint joint = new AxleJoint(cart, cartWheel); 
     129        //Add(joint); 
     130    } 
     131 
     132    void ScreenSettings() 
     133    { 
     134        Window.Width = 1800; 
     135        Window.Height = 900; 
     136 
     137        Camera.X = cameraTargetX = players[0].X; 
     138        //Camera.ZoomToLevel(); 
     139 
     140        Timer cameraTimer = new Timer(); 
     141        cameraTimer.Interval = 1 / 30.0; 
     142        cameraTimer.Timeout += UpdateCamera; 
     143        cameraTimer.Start(); 
     144    } 
     145 
     146    void CreateLevel() 
     147    { 
     148        Gravity = new Vector(0, -1000); 
     149 
     150        ColorTileMap level = ColorTileMap.FromLevelAsset("level" + levelNumber); 
     151        level.SetTileMethod(Color.Black, CreateGroundTop); 
     152        level.SetTileMethod(Color.Brown, CreateGround); 
     153        level.SetTileMethod(Color.Cyan, CreateDummy, Color.Cyan);   //TODO: CreatePlatform 
     154        level.SetTileMethod(Color.Gold, CreatePlayer); 
     155        level.SetTileMethod(Color.Rose, CreateDummy, Color.Rose);   //TODO: CreateFlame 
     156        level.SetTileMethod(Color.Harlequin, CreateCart); 
     157        level.SetTileMethod(Color.White, CreateDummy, Color.White); //TODO: CreateSmoke 
     158        level.SetTileMethod(Color.PaintDotNetBlue, CreateDummy, Color.PaintDotNetBlue); //TODO: CreateImprovement 
     159        level.SetTileMethod(Color.DarkGray, CreateDummy, Color.DarkGray);   //TODO: CreateTombStone 
     160        level.SetTileMethod(Color.Gray, CreateDummy, Color.Gray);  //TODO: CreateCrawly 
     161        level.SetTileMethod(Color.Red, CreateDummy, Color.Red);    //TODO: CreateWitch 
     162        level.Execute(TILE_SIZE, TILE_SIZE); 
     163 
     164 
     165        //TileMap level = TileMap.FromLevelAsset("level" + levelNumber); 
     166        //level.SetTileMethod('P', CreatePlayer); 
     167        //level.SetTileMethod('#', CreateGroundTop); 
     168        //level.SetTileMethod('%', CreateGround); 
     169        //level.Optimize('#', '%'); 
     170        //level.Execute(TILE_SIZE, TILE_SIZE); 
     171        //Level.CreateBorders(true); 
     172 
     173        SetControls(); 
     174    } 
     175 
     176    private void CreateCart(Vector position, double width, double height) 
     177    { 
    115178        double size = 0.7; 
    116179        PhysicsObject cart = new PhysicsObject(400 * size, 80 * size); 
    117         cart.X = -1600; 
    118         cart.Y = 200; 
     180        cart.Position = position; 
    119181        cart.Image = cartImage; 
    120182        cart.CollisionIgnoreGroup = 2; 
     
    129191    } 
    130192 
    131     void ScreenSettings() 
    132     { 
    133         Window.Width = 1800; 
    134         Window.Height = 900; 
    135  
    136         Camera.X = cameraTargetX = players[0].X; 
    137  
    138         Timer cameraTimer = new Timer(); 
    139         cameraTimer.Interval = 1 / 30.0; 
    140         cameraTimer.Timeout += UpdateCamera; 
    141         cameraTimer.Start(); 
    142     } 
    143  
    144     void CreateLevel() 
    145     { 
    146         Gravity = new Vector(0, -1000); 
    147  
    148         TileMap level = TileMap.FromLevelAsset("level" + levelNumber); 
    149         level.SetTileMethod('P', CreatePlayer); 
    150         level.SetTileMethod('#', CreateGroundTop); 
    151         level.SetTileMethod('%', CreateGround); 
    152         level.Optimize('#', '%'); 
    153         level.Execute(TILE_SIZE, TILE_SIZE); 
    154         //Level.CreateBorders(true); 
    155  
    156         SetControls(); 
     193 
     194    private void CreateDummy(Vector position, double width, double height, Color color) 
     195    { 
     196        PhysicsObject dummy = PhysicsObject.CreateStaticObject(width, height); 
     197        dummy.Position = position; 
     198        dummy.Color = color; 
     199        //dummy.TextureWrapSize = new Vector(width / TILE_SIZE, height / TILE_SIZE); 
     200        Add(dummy); 
    157201    } 
    158202 
  • 2015/26/ohjaajat/HillbillyRun/HillbillyRun/HillbillyRun/HillbillyRunContent/HillbillyRunContent.contentproj

    r6156 r6197  
    4747  </ItemGroup> 
    4848  <ItemGroup> 
    49     <Compile Include="level1.txt"> 
    50       <Name>level1</Name> 
     49    <Compile Include="nope.txt"> 
     50      <Name>nope</Name> 
    5151      <Importer>TextFileImporter</Importer> 
    5252      <Processor>TextFileContentProcessor</Processor> 
     
    7979    </Compile> 
    8080  </ItemGroup> 
     81  <ItemGroup> 
     82    <Compile Include="level0.png"> 
     83      <Name>level0</Name> 
     84      <Importer>TextureImporter</Importer> 
     85      <Processor>TextureProcessor</Processor> 
     86    </Compile> 
     87  </ItemGroup> 
    8188  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    8289  <!--  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.