Changeset 3747 for 2012/30


Ignore:
Timestamp:
2012-07-25 15:00:23 (11 years ago)
Author:
anlakane
Message:

Talletus.

Location:
2012/30/JyriP
Files:
39 added
3 edited

Legend:

Unmodified
Added
Removed
  • 2012/30/JyriP/Lofen/Lofen/Lofen/Lofen.cs

    r3730 r3747  
    1111    PhysicsObject player; 
    1212    PhysicsObject Reaper; 
     13 
     14    int WorldCounter = 1; 
     15     
     16 
    1317    public override void Begin() 
    1418    { 
     19        IsMouseVisible = true; 
    1520        Window.Title = "Lofen"; 
    1621        Start(); 
     
    2025    void Start() 
    2126    { 
    22         CreateBackgroundWorld(); 
    23         CreateWorld(); 
    24         SetControls(); 
    25          
    26     } 
     27        MainMenu(); 
     28    } 
     29 
     30    //Menu 
     31    void MainMenu() 
     32    { 
     33 
     34        ClearAll(); 
     35        MultiSelectWindow mainMenu = new MultiSelectWindow("Lofen", "Start New Game", "Exit"); 
     36        mainMenu.DefaultCancel = 3; 
     37        mainMenu.DefaultCancel = -1; 
     38        mainMenu.Color = Level.BackgroundColor; 
     39        mainMenu.ItemSelected += pressedMenuItem; 
     40 
     41        Add(mainMenu); 
     42    } 
     43 
     44    void pressedMenuItem(int MenuItem) 
     45    { 
     46        switch (MenuItem) 
     47        { 
     48            case 0: 
     49                CreateBackgroundWorld(); 
     50                CreateWorld1(); 
     51                SetControls();   
     52 
     53            break; 
     54 
     55            case 1: 
     56                Exit(); 
     57            break; 
     58        } 
     59    } 
     60 
    2761 
    2862    void CreateBackgroundWorld() 
    2963    { 
    3064        TileMap world = TileMap.FromLevelAsset("World/bgMap"); 
    31         world.SetTileMethod('.', bg); 
     65        world.SetTileMethod('.', bgGrass); 
     66        world.SetTileMethod('s', bgSand); 
     67        world.SetTileMethod('w', bgBWater); 
     68        world.SetTileMethod('q', bgWater); 
    3269        world.Execute(32, 32); 
    3370    } 
    3471 
    35     void bg(Vector pos, double width, double height) 
     72    void bgGrass(Vector pos, double width, double height) 
    3673    { 
    3774        PhysicsObject tileBG = PhysicsObject.CreateStaticObject(width, height); 
    3875        tileBG.IgnoresCollisionResponse = true; 
    3976 
    40         Image textureGrass = Game.LoadImage("World/grass"); 
    41         tileBG.Image = textureGrass; 
     77        Image texture = Game.LoadImage("World/textures/grass"); 
     78        tileBG.Image = texture; 
    4279 
    4380        tileBG.Position = pos; 
     
    4986    } 
    5087 
    51     void CreateWorld() 
    52     { 
    53         TileMap world = TileMap.FromLevelAsset("map"); 
     88    void bgSand(Vector pos, double width, double height) 
     89    { 
     90        PhysicsObject tileBG = PhysicsObject.CreateStaticObject(width, height); 
     91        tileBG.IgnoresCollisionResponse = true; 
     92 
     93        Image texture = Game.LoadImage("World/textures/sand"); 
     94        tileBG.Image = texture; 
     95 
     96        tileBG.Position = pos; 
     97        tileBG.Shape = Shape.Rectangle; 
     98 
     99 
     100 
     101        Add(tileBG, -1); 
     102    } 
     103 
     104    void bgBWater(Vector pos, double width, double height) 
     105    { 
     106        PhysicsObject tileBG = PhysicsObject.CreateStaticObject(width, height); 
     107        tileBG.IgnoresCollisionResponse = false; 
     108 
     109        Image[] texture = Game.LoadImages("World/textures/bWater", "World/textures/bWater2"); 
     110        tileBG.Animation = new Animation(texture); 
     111 
     112        tileBG.Animation.FPS = 3; 
     113        tileBG.Animation.Start(); 
     114 
     115        tileBG.Position = pos; 
     116        tileBG.Shape = Shape.Rectangle; 
     117 
     118 
     119 
     120        Add(tileBG, -1); 
     121    } 
     122 
     123    void bgWater(Vector pos, double width, double height) 
     124    { 
     125        PhysicsObject tileBG = PhysicsObject.CreateStaticObject(width, height); 
     126        tileBG.IgnoresCollisionResponse = false; 
     127 
     128        Image[] texture = Game.LoadImages("World/textures/Water", "World/textures/Water2"); 
     129        tileBG.Animation = new Animation(texture); 
     130 
     131        tileBG.Animation.FPS = 3; 
     132        tileBG.Animation.Start(); 
     133 
     134        tileBG.Position = pos; 
     135        tileBG.Shape = Shape.Rectangle; 
     136 
     137 
     138 
     139        Add(tileBG, -1); 
     140    } 
     141 
     142    void CreateWorld1() 
     143    { 
     144        TileMap world = TileMap.FromLevelAsset("World/map"); 
    54145         
    55146        //Ympäristö 
     
    67158        world.Execute(32, 32); 
    68159         
    69         player = CreatePlayer(Level.Left + 20, 0); 
    70  
    71         Reaper = CreateReaper(Level.Bottom - 20, 0); 
    72     } 
    73  
     160        player = CreatePlayer(Level.Left + 200, 0); 
     161 
     162        Reaper = CreateReaper(Level.Left + 200.0, 200); 
     163    } 
    74164    //Player, NPC 
    75165    PhysicsObject CreatePlayer(double x, double y) 
     
    83173        Player.Animation.Start(); 
    84174        Player.CanRotate = false; 
     175        Player.Tag = "Player"; 
    85176 
    86177        Add(Player, 1); 
     
    99190        Reaper.CanRotate = false; 
    100191 
     192        RandomMoverBrain reaperAI = new RandomMoverBrain(50); 
     193        reaperAI.ChangeMovementSeconds = 5; 
     194         
     195        Reaper.Brain = reaperAI; 
     196 
    101197        Add(Reaper, 1); 
    102198        return Reaper; 
     
    110206        tile.IgnoresCollisionResponse = true; 
    111207 
    112         Image textureGrass = Game.LoadImage("World/grass"); 
    113         tile.Image = textureGrass; 
     208        Image texture = Game.LoadImage("World/textures/grass"); 
     209        tile.Image = texture; 
    114210 
    115211        tile.Position = pos; 
     
    126222        tile.CollisionIgnoreGroup = 1; 
    127223 
    128         Image textureGrass = Game.LoadImage("World/rock"); 
    129         tile.Image = textureGrass; 
     224        Image texture = Game.LoadImage("World/textures/rock"); 
     225        tile.Image = texture; 
    130226 
    131227        tile.Position = pos; 
     
    141237        tile.CollisionIgnoreGroup = 1; 
    142238 
    143         Image textureGrass = Game.LoadImage("World/tree"); 
    144         tile.Image = textureGrass; 
    145  
     239        Image[] texture = Game.LoadImages("World/textures/tree", "World/textures/tree2"); 
     240        tile.Animation = new Animation(texture); 
     241        tile.Animation.FPS = 1; 
     242        tile.Animation.Start(); 
    146243        tile.Position = pos; 
    147244        tile.Shape = Shape.Rectangle; 
     
    158255        tile.CollisionIgnoreGroup = 1; 
    159256 
    160         Image textureGrass = Game.LoadImage("World/houseRoofL"); 
    161         tile.Image = textureGrass; 
     257        Image texture = Game.LoadImage("World/textures/houseRoofL"); 
     258        tile.Image = texture; 
    162259 
    163260        tile.Position = pos; 
     
    174271        tile.CollisionIgnoreGroup = 1; 
    175272 
    176         Image textureGrass = Game.LoadImage("World/houseRoofR"); 
    177         tile.Image = textureGrass; 
     273        Image texture = Game.LoadImage("World/textures/houseRoofR"); 
     274        tile.Image = texture; 
    178275 
    179276        tile.Position = pos; 
     
    190287        tile.CollisionIgnoreGroup = 1; 
    191288 
    192         Image textureGrass = Game.LoadImage("World/houseBottomL"); 
    193         tile.Image = textureGrass; 
     289        Image texture = Game.LoadImage("World/textures/houseBottomL"); 
     290        tile.Image = texture; 
    194291 
    195292        tile.Position = pos; 
     
    206303        tile.CollisionIgnoreGroup = 1; 
    207304 
    208         Image textureGrass = Game.LoadImage("World/houseBottomR"); 
    209         tile.Image = textureGrass; 
     305        Image texture = Game.LoadImage("World/textures/houseBottomR"); 
     306        tile.Image = texture; 
    210307 
    211308        tile.Position = pos; 
     
    222319    void SetControls() 
    223320    { 
    224         IsMouseVisible = true; 
    225321        Mouse.Listen(MouseButton.Left, ButtonState.Pressed, Move, ""); 
     322        Keyboard.Listen(Key.Escape, ButtonState.Pressed, MainMenu, ""); 
    226323    } 
    227324 
     
    231328    } 
    232329 
     330 
    233331} 
  • 2012/30/JyriP/Lofen/Lofen/LofenContent/LofenContent.contentproj

    r3730 r3747  
    6969  </ItemGroup> 
    7070  <ItemGroup> 
    71     <Compile Include="World1.txt"> 
     71    <Compile Include="World\World1.txt"> 
    7272      <Name>map</Name> 
    7373      <Importer>TextFileImporter</Importer> 
     
    7777  </ItemGroup> 
    7878  <ItemGroup> 
    79     <Compile Include="World\grass.png"> 
     79    <Compile Include="World\textures\grass.png"> 
    8080      <Name>grass</Name> 
    8181      <Importer>TextureImporter</Importer> 
     
    8484  </ItemGroup> 
    8585  <ItemGroup> 
    86     <Compile Include="World\rock.png"> 
     86    <Compile Include="World\textures\rock.png"> 
    8787      <Name>rock</Name> 
    8888      <Importer>TextureImporter</Importer> 
     
    9999  </ItemGroup> 
    100100  <ItemGroup> 
    101     <Compile Include="World\houseRoofL.png"> 
     101    <Compile Include="World\textures\houseRoofL.png"> 
    102102      <Name>houseRoofL</Name> 
    103103      <Importer>TextureImporter</Importer> 
    104104      <Processor>TextureProcessor</Processor> 
    105105    </Compile> 
    106     <Compile Include="World\houseRoofR.png"> 
     106    <Compile Include="World\textures\houseRoofR.png"> 
    107107      <Name>houseRoofR</Name> 
    108108      <Importer>TextureImporter</Importer> 
     
    111111  </ItemGroup> 
    112112  <ItemGroup> 
    113     <Compile Include="World\houseBottomL.png"> 
     113    <Compile Include="World\textures\houseBottomL.png"> 
    114114      <Name>houseBottomL</Name> 
    115115      <Importer>TextureImporter</Importer> 
    116116      <Processor>TextureProcessor</Processor> 
    117117    </Compile> 
    118     <Compile Include="World\houseBottomR.png"> 
     118    <Compile Include="World\textures\houseBottomR.png"> 
    119119      <Name>houseBottomR</Name> 
    120120      <Importer>TextureImporter</Importer> 
     
    123123  </ItemGroup> 
    124124  <ItemGroup> 
    125     <Compile Include="World\tree.png"> 
     125    <Compile Include="World\textures\tree.png"> 
    126126      <Name>tree</Name> 
    127127      <Importer>TextureImporter</Importer> 
     
    130130  </ItemGroup> 
    131131  <ItemGroup> 
    132     <Compile Include="reeper.png"> 
    133       <Name>reeper</Name> 
    134       <Importer>TextureImporter</Importer> 
    135       <Processor>TextureProcessor</Processor> 
    136     </Compile> 
    137   </ItemGroup> 
    138   <ItemGroup> 
    139     <Compile Include="reeper2.png"> 
    140       <Name>reeper2</Name> 
     132    <Compile Include="reaper.png"> 
     133      <Name>reaper</Name> 
     134      <Importer>TextureImporter</Importer> 
     135      <Processor>TextureProcessor</Processor> 
     136    </Compile> 
     137  </ItemGroup> 
     138  <ItemGroup> 
     139    <Compile Include="reaper2.png"> 
     140      <Name>reaper2</Name> 
    141141      <Importer>TextureImporter</Importer> 
    142142      <Processor>TextureProcessor</Processor> 
     
    145145  <ItemGroup> 
    146146    <Folder Include="sprites\enemies\reeper\" /> 
     147  </ItemGroup> 
     148  <ItemGroup> 
     149    <Compile Include="World\textures\sand.png"> 
     150      <Name>sand</Name> 
     151      <Importer>TextureImporter</Importer> 
     152      <Processor>TextureProcessor</Processor> 
     153    </Compile> 
     154  </ItemGroup> 
     155  <ItemGroup> 
     156    <Compile Include="World\textures\bWater.png"> 
     157      <Name>bWater</Name> 
     158      <Importer>TextureImporter</Importer> 
     159      <Processor>TextureProcessor</Processor> 
     160    </Compile> 
     161    <Compile Include="World\textures\water.png"> 
     162      <Name>water</Name> 
     163      <Importer>TextureImporter</Importer> 
     164      <Processor>TextureProcessor</Processor> 
     165    </Compile> 
     166  </ItemGroup> 
     167  <ItemGroup> 
     168    <Compile Include="World\textures\bWater2.png"> 
     169      <Name>bWater2</Name> 
     170      <Importer>TextureImporter</Importer> 
     171      <Processor>TextureProcessor</Processor> 
     172    </Compile> 
     173  </ItemGroup> 
     174  <ItemGroup> 
     175    <Compile Include="World\textures\water2.png"> 
     176      <Name>water2</Name> 
     177      <Importer>TextureImporter</Importer> 
     178      <Processor>TextureProcessor</Processor> 
     179    </Compile> 
     180  </ItemGroup> 
     181  <ItemGroup> 
     182    <Compile Include="World\textures\tree2.png"> 
     183      <Name>tree2</Name> 
     184      <Importer>TextureImporter</Importer> 
     185      <Processor>TextureProcessor</Processor> 
     186    </Compile> 
     187  </ItemGroup> 
     188  <ItemGroup> 
     189    <Compile Include="World\map2.txt"> 
     190      <Name>map2</Name> 
     191      <Importer>TextFileImporter</Importer> 
     192      <Processor>TextFileContentProcessor</Processor> 
     193    </Compile> 
     194    <Compile Include="World\map3.txt"> 
     195      <Name>map3</Name> 
     196      <Importer>TextFileImporter</Importer> 
     197      <Processor>TextFileContentProcessor</Processor> 
     198    </Compile> 
    147199  </ItemGroup> 
    148200  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
  • 2012/30/JyriP/Lofen/Lofen/LofenContent/World/bgMap.txt

    r3730 r3747  
    1616................................................................... 
    1717................................................................... 
     18.................................................................. 
    1819................................................................... 
    1920................................................................... 
     
    2425................................................................... 
    2526................................................................... 
    26 ................................................................... 
    27 ................................................................... 
    28 ................................................................... 
    29 ................................................................... 
    30 ................................................................... 
    31 ................................................................... 
    32 ................................................................... 
    33 ................................................................... 
    34 ................................................................... 
    35 ................................................................... 
     27............s......................s.............................. 
     28...ss.....ssss.............s......sssssss.....................sss.. 
     29.s.ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss 
     30sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss 
     31wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww 
     32qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq 
     33qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq 
Note: See TracChangeset for help on using the changeset viewer.