Changeset 8917 for 2017/27/PyryS


Ignore:
Timestamp:
2017-07-05 11:59:54 (2 years ago)
Author:
npo17_32
Message:

more graphics, full random generation for GravityAssist?.

Location:
2017/27/PyryS/GravityAssist
Files:
23 added
15 edited

Legend:

Unmodified
Added
Removed
  • 2017/27/PyryS/GravityAssist/GravityAssist/GravityAssist/GravityAssist.cs

    r8896 r8917  
    1313    const int RUUDUN_KOKO = 40; 
    1414 
     15    double levelCreationX = 0; 
     16 
    1517    bool GravityDirection; 
    1618 
     
    2426    Image damagedWall0 = LoadImage("SpaceStationWallDamaged0"); 
    2527 
    26     Image obstacle0 = LoadImage("Obstacle0"); 
     28    Image[] obstacle0 = LoadImages("Obstacle0", "Obstacle1", "Obstacle2", "Obstacle0"); 
     29    Image[] obstacle1 = LoadImages("ObstacleB0", "ObstacleB1", "ObstacleB2", "ObstacleB3", "ObstacleB0"); 
     30    Image obstacle2 = LoadImage("ObstacleC0"); 
    2731    Image background0 = LoadImage("background0"); 
    2832 
     
    3135    public override void Begin() 
    3236    { 
     37        levelCreationX = 0; 
    3338        Gravity = new Vector(0, 0); 
    3439        SmoothTextures = false; 
    3540 
    3641        LuoKentta(); 
     42        LisaaPelaaja(new Vector(Level.Left + 50, 0), RUUDUN_KOKO, RUUDUN_KOKO); 
    3743        LisaaNappaimet(); 
    3844 
    39         Camera.Follow(player); 
    40         Camera.ZoomFactor = 1.0; 
    41         Camera.StayInLevel = true; 
     45 
     46        Camera.FollowX(player); 
     47        Camera.ZoomFactor = 4.0; 
     48        //Camera.StayInLevel = true; 
    4249 
    4350        //Level.Background.Image = background0; 
     
    5259    void LuoKentta() 
    5360    { 
    54         TileMap kentta = TileMap.FromLevelAsset("kentta1"); 
     61        TileMap kentta = TileMap.FromLevelAsset("kentta"+ RandomGen.NextInt(1, 4)); 
    5562        kentta.SetTileMethod('A', LisaaTaso, false); 
    5663        kentta.SetTileMethod('V', LisaaTaso, true); 
    57         kentta.SetTileMethod('.', AddObstacle, true); 
    58         kentta.SetTileMethod(',', AddObstacle, false); 
     64        kentta.SetTileMethod('.', RandomizeObstacle0, true); 
     65        kentta.SetTileMethod(',', RandomizeObstacle1, false); 
    5966        kentta.SetTileMethod('N', LisaaPelaaja); 
     67        kentta.SetTileMethod('+', AddLevelSwitcher); 
    6068        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO); 
    6169        Level.CreateBorders(); 
    6270        Level.Background.Color = Color.Black; 
     71 
     72        levelCreationX += Level.Width; 
    6373    } 
    6474    // Level generation function 
     
    6777        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    6878        taso.Position = paikka; 
     79        taso.X += levelCreationX; 
    6980        taso.Image = RandomGen.SelectOne(wall0, wall0, wall0, wall0,wall0, wall0, wall0, wall0, wall1, damagedWall0); 
    7081        if (flipped) taso.FlipImage(); 
     
    7384        taso.StaticFriction = 0.0; 
    7485        taso.Tag = "wall"; 
     86        taso.LifetimeLeft = TimeSpan.FromSeconds(60); 
    7587        Add(taso); 
    7688    } 
    77     // Obstacle creation function 
    78     void AddObstacle(Vector paikka, double leveys, double korkeus, bool flipped) 
    79     { 
    80         PhysicsObject obstacle = PhysicsObject.CreateStaticObject(korkeus, leveys, Shape.FromImage(obstacle0)); 
     89    void RandomizeObstacle0(Vector paikka, double leveys, double korkeus, bool flipped) 
     90    { 
     91        RandomGen.SelectOne<Action<Vector, double, double, bool>>(AddObstacle0, AddObstacle1)(paikka, leveys, korkeus, flipped); 
     92    } 
     93 
     94    void RandomizeObstacle1(Vector paikka, double leveys, double korkeus, bool flipped) 
     95    { 
     96        RandomGen.SelectOne<Action<Vector, double, double, bool>>(AddObstacle0, AddObstacle2)(paikka, leveys, korkeus, flipped); 
     97    } 
     98 
     99    // Obstacle creation function 0 (Hull Puncture) 
     100    void AddObstacle0(Vector paikka, double leveys, double korkeus, bool flipped) 
     101    { 
     102        PhysicsObject obstacle = PhysicsObject.CreateStaticObject(korkeus, leveys, Shape.FromImage(obstacle0[0])); 
    81103        obstacle.IgnoresCollisionResponse = true; 
    82         obstacle.Image = obstacle0; 
     104        obstacle.Image = obstacle0[0]; 
     105        obstacle.Animation = new Animation(obstacle0); 
     106        obstacle.Animation.FPS = 5; 
     107        obstacle.Animation.Start(); 
     108        obstacle.Position = paikka; 
    83109        if (flipped) 
    84110        { 
    85111            obstacle.FlipImage(); 
    86             obstacle.Position = paikka + new Vector(Convert.ToInt64(RandomGen.NextDouble(Level.Left, Level.Right)), -10); 
     112            obstacle.Position = paikka + new Vector(0, -10); 
     113            //obstacle.Position = paikka + new Vector(Convert.ToInt64(RandomGen.NextDouble(Level.Left, Level.Right)), -10); 
    87114        } 
    88115        else 
    89116        { 
    90             obstacle.Position = paikka + new Vector(Convert.ToInt64(RandomGen.NextDouble(Level.Left, Level.Right)), 10); 
    91         } 
     117            //obstacle.Position = paikka + new Vector(Convert.ToInt64(RandomGen.NextDouble(Level.Left + 25, Level.Right)), 10); 
     118            obstacle.Position = paikka + new Vector(0, 10); 
     119        } 
     120        obstacle.X += levelCreationX; 
    92121        obstacle.Tag = "obstacle"; 
    93         Add(obstacle); 
     122        Add(obstacle, 2); 
     123    } 
     124    // Obstacle creation function 1 (Broken Console) 
     125    void AddObstacle1(Vector paikka, double leveys, double korkeus, bool flipped) 
     126    { 
     127        PhysicsObject obstacle = PhysicsObject.CreateStaticObject(korkeus, leveys, Shape.FromImage(obstacle1[0])); 
     128        obstacle.IgnoresCollisionResponse = true; 
     129        obstacle.Image = obstacle1[0]; 
     130        obstacle.Animation = new Animation(obstacle1); 
     131        obstacle.Animation.FPS = 5; 
     132        obstacle.Animation.Start(); 
     133        obstacle.Position = paikka; 
     134        obstacle.Position = paikka + new Vector(0, -10); 
     135        obstacle.X += levelCreationX; 
     136        obstacle.Tag = "obstacle"; 
     137        Add(obstacle, 2); 
     138    } 
     139 
     140    // Obstacle creation function 2 (Broken Pipe) 
     141    void AddObstacle2(Vector paikka, double leveys, double korkeus, bool flipped) 
     142    { 
     143        PhysicsObject obstacle = PhysicsObject.CreateStaticObject(korkeus, leveys, Shape.FromImage(obstacle2)); 
     144        obstacle.IgnoresCollisionResponse = true; 
     145        obstacle.Image = obstacle2; 
     146        obstacle.Position = paikka; 
     147        obstacle.Position = paikka + new Vector(0, 10); 
     148        obstacle.X += levelCreationX; 
     149        obstacle.Tag = "obstacle"; 
     150        Add(obstacle, 2); 
     151    } 
     152 
     153 
     154    // Level switch block creation function 
     155    void AddLevelSwitcher(Vector paikka, double leveys, double korkeus) 
     156    { 
     157        PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, Level.Height); 
     158        taso.IgnoresCollisionResponse = true; 
     159        taso.Position = paikka; 
     160        taso.X += levelCreationX; 
     161        taso.Tag = "levelswitch"; 
     162        Add(taso); 
    94163    } 
    95164    // Player creation and movement function 
     
    108177        player.Animation.Start(); 
    109178        AddCollisionHandler(player, collision); 
     179        AddCollisionHandler(player, "levelswitch", LevelSwitch); 
    110180        Add(player); 
    111181        player.IgnoresCollisionResponse = true; 
     
    155225            MessageDisplay.Add("You died."); 
    156226            player.Destroy(); 
    157             restart(); 
     227            Timer.SingleShot(0.5, delegate { restart(); }); 
    158228        } 
    159229 
     
    171241        }   
    172242    } 
     243    void LevelSwitch(PhysicsObject player, PhysicsObject levelSwitcher) 
     244    { 
     245        levelSwitcher.Destroy(); 
     246        LuoKentta(); 
     247    } 
    173248    void restart() 
    174249    { 
  • 2017/27/PyryS/GravityAssist/GravityAssist/GravityAssist/GravityAssist.csproj.Debug.cachefile

    r8896 r8917  
    99Content\Background0.xnb 
    1010Content\SpaceStationWallDamaged0.xnb 
     11Content\kentta2.xnb 
     12Content\Obstacle1.xnb 
     13Content\Obstacle2.xnb 
     14Content\obstacleB0.xnb 
     15Content\obstacleB1.xnb 
     16Content\obstacleB2.xnb 
     17Content\obstacleB3.xnb 
     18Content\DeathExplosion.xnb 
     19Content\ObstacleC0.xnb 
     20Content\kentta3.xnb 
  • 2017/27/PyryS/GravityAssist/GravityAssist/GravityAssist/obj/x86/Debug/ContentPipeline-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}.xml

    r8896 r8917  
    2727      <Options>None</Options> 
    2828      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\kentta1.xnb</Output> 
    29       <Time>2017-07-04T14:27:37.572787+03:00</Time> 
     29      <Time>2017-07-05T10:11:22.508884+03:00</Time> 
    3030    </Item> 
    3131    <Item> 
     
    7272      <Options>None</Options> 
    7373      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\Obstacle0.xnb</Output> 
    74       <Time>2017-07-04T14:52:46.5246411+03:00</Time> 
     74      <Time>2017-07-05T10:25:12.6092879+03:00</Time> 
    7575    </Item> 
    7676    <Item> 
     
    9191      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\SpaceStationWallDamaged0.xnb</Output> 
    9292      <Time>2017-07-04T14:13:37.9909988+03:00</Time> 
     93    </Item> 
     94    <Item> 
     95      <Source>kentta2.txt</Source> 
     96      <Name>kentta2</Name> 
     97      <Importer>TextFileImporter</Importer> 
     98      <Processor>TextFileContentProcessor</Processor> 
     99      <Options>None</Options> 
     100      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\kentta2.xnb</Output> 
     101      <Time>2017-07-05T10:12:07.542944+03:00</Time> 
     102    </Item> 
     103    <Item> 
     104      <Source>Obstacle1.png</Source> 
     105      <Name>Obstacle1</Name> 
     106      <Importer>TextureImporter</Importer> 
     107      <Processor>TextureProcessor</Processor> 
     108      <Options>None</Options> 
     109      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\Obstacle1.xnb</Output> 
     110      <Time>2017-07-04T14:29:09.5357843+03:00</Time> 
     111    </Item> 
     112    <Item> 
     113      <Source>Obstacle2.png</Source> 
     114      <Name>Obstacle2</Name> 
     115      <Importer>TextureImporter</Importer> 
     116      <Processor>TextureProcessor</Processor> 
     117      <Options>None</Options> 
     118      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\Obstacle2.xnb</Output> 
     119      <Time>2017-07-04T14:29:07.2580967+03:00</Time> 
     120    </Item> 
     121    <Item> 
     122      <Source>obstacleB0.png</Source> 
     123      <Name>obstacleB0</Name> 
     124      <Importer>TextureImporter</Importer> 
     125      <Processor>TextureProcessor</Processor> 
     126      <Options>None</Options> 
     127      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\obstacleB0.xnb</Output> 
     128      <Time>2017-07-05T10:56:17.8318888+03:00</Time> 
     129    </Item> 
     130    <Item> 
     131      <Source>obstacleB1.png</Source> 
     132      <Name>obstacleB1</Name> 
     133      <Importer>TextureImporter</Importer> 
     134      <Processor>TextureProcessor</Processor> 
     135      <Options>None</Options> 
     136      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\obstacleB1.xnb</Output> 
     137      <Time>2017-07-05T10:58:23.043502+03:00</Time> 
     138    </Item> 
     139    <Item> 
     140      <Source>obstacleB2.png</Source> 
     141      <Name>obstacleB2</Name> 
     142      <Importer>TextureImporter</Importer> 
     143      <Processor>TextureProcessor</Processor> 
     144      <Options>None</Options> 
     145      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\obstacleB2.xnb</Output> 
     146      <Time>2017-07-05T11:00:49.1587851+03:00</Time> 
     147    </Item> 
     148    <Item> 
     149      <Source>obstacleB3.png</Source> 
     150      <Name>obstacleB3</Name> 
     151      <Importer>TextureImporter</Importer> 
     152      <Processor>TextureProcessor</Processor> 
     153      <Options>None</Options> 
     154      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\obstacleB3.xnb</Output> 
     155      <Time>2017-07-05T11:02:29.2525932+03:00</Time> 
     156    </Item> 
     157    <Item> 
     158      <Source>DeathExplosion.png</Source> 
     159      <Name>DeathExplosion</Name> 
     160      <Importer>TextureImporter</Importer> 
     161      <Processor>TextureProcessor</Processor> 
     162      <Options>None</Options> 
     163      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\DeathExplosion.xnb</Output> 
     164      <Time>2017-07-05T11:30:00.8754107+03:00</Time> 
     165    </Item> 
     166    <Item> 
     167      <Source>ObstacleC0.png</Source> 
     168      <Name>ObstacleC0</Name> 
     169      <Importer>TextureImporter</Importer> 
     170      <Processor>TextureProcessor</Processor> 
     171      <Options>None</Options> 
     172      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\ObstacleC0.xnb</Output> 
     173      <Time>2017-07-05T11:38:23.1745298+03:00</Time> 
     174    </Item> 
     175    <Item> 
     176      <Source>kentta3.txt</Source> 
     177      <Name>kentta3</Name> 
     178      <Importer>TextFileImporter</Importer> 
     179      <Processor>TextFileContentProcessor</Processor> 
     180      <Options>None</Options> 
     181      <Output>C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\kentta3.xnb</Output> 
     182      <Time>2017-07-05T11:57:34.1538891+03:00</Time> 
    93183    </Item> 
    94184    <BuildSuccessful>true</BuildSuccessful> 
  • 2017/27/PyryS/GravityAssist/GravityAssist/GravityAssist/obj/x86/Debug/GravityAssist.csproj.FileListAbsolute.txt

    r8896 r8917  
    1717C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\Background0.xnb 
    1818C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\SpaceStationWallDamaged0.xnb 
     19C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\kentta2.xnb 
     20C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\Obstacle1.xnb 
     21C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\Obstacle2.xnb 
     22C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\obstacleB0.xnb 
     23C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\obstacleB1.xnb 
     24C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\obstacleB2.xnb 
     25C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\obstacleB3.xnb 
     26C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\DeathExplosion.xnb 
     27C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\ObstacleC0.xnb 
     28C:\MyTemp\PyryS\GravityAssist\GravityAssist\GravityAssist\bin\x86\Debug\Content\kentta3.xnb 
  • 2017/27/PyryS/GravityAssist/GravityAssist/GravityAssist/obj/x86/Debug/cachefile-{FB1067CC-FEED-45F1-8CB8-8F3DD59AB260}-targetpath.txt

    r8896 r8917  
    99Content\Background0.xnb 
    1010Content\SpaceStationWallDamaged0.xnb 
     11Content\kentta2.xnb 
     12Content\Obstacle1.xnb 
     13Content\Obstacle2.xnb 
     14Content\obstacleB0.xnb 
     15Content\obstacleB1.xnb 
     16Content\obstacleB2.xnb 
     17Content\obstacleB3.xnb 
     18Content\DeathExplosion.xnb 
     19Content\ObstacleC0.xnb 
     20Content\kentta3.xnb 
  • 2017/27/PyryS/GravityAssist/GravityAssist/GravityAssistContent/GravityAssistContent.contentproj

    r8896 r8917  
    5656      <Processor>TextureProcessor</Processor> 
    5757    </Compile> 
    58     <Compile Include="kentta1.txt"> 
    59       <Name>kentta1</Name> 
     58    <Compile Include="kentta2.txt"> 
     59      <Name>kentta2</Name> 
    6060      <Importer>TextFileImporter</Importer> 
    6161      <Processor>TextFileContentProcessor</Processor> 
     
    111111    </Compile> 
    112112  </ItemGroup> 
     113  <ItemGroup> 
     114    <Compile Include="kentta1.txt"> 
     115      <Name>kentta1</Name> 
     116      <Importer>TextFileImporter</Importer> 
     117      <Processor>TextFileContentProcessor</Processor> 
     118    </Compile> 
     119  </ItemGroup> 
     120  <ItemGroup> 
     121    <Compile Include="Obstacle1.png"> 
     122      <Name>Obstacle1</Name> 
     123      <Importer>TextureImporter</Importer> 
     124      <Processor>TextureProcessor</Processor> 
     125    </Compile> 
     126  </ItemGroup> 
     127  <ItemGroup> 
     128    <Compile Include="Obstacle2.png"> 
     129      <Name>Obstacle2</Name> 
     130      <Importer>TextureImporter</Importer> 
     131      <Processor>TextureProcessor</Processor> 
     132    </Compile> 
     133  </ItemGroup> 
     134  <ItemGroup> 
     135    <Compile Include="obstacleB0.png"> 
     136      <Name>obstacleB0</Name> 
     137      <Importer>TextureImporter</Importer> 
     138      <Processor>TextureProcessor</Processor> 
     139    </Compile> 
     140    <Compile Include="obstacleB1.png"> 
     141      <Name>obstacleB1</Name> 
     142      <Importer>TextureImporter</Importer> 
     143      <Processor>TextureProcessor</Processor> 
     144    </Compile> 
     145    <Compile Include="obstacleB2.png"> 
     146      <Name>obstacleB2</Name> 
     147      <Importer>TextureImporter</Importer> 
     148      <Processor>TextureProcessor</Processor> 
     149    </Compile> 
     150    <Compile Include="obstacleB3.png"> 
     151      <Name>obstacleB3</Name> 
     152      <Importer>TextureImporter</Importer> 
     153      <Processor>TextureProcessor</Processor> 
     154    </Compile> 
     155  </ItemGroup> 
     156  <ItemGroup> 
     157    <Compile Include="DeathExplosion.png"> 
     158      <Name>DeathExplosion</Name> 
     159      <Importer>TextureImporter</Importer> 
     160      <Processor>TextureProcessor</Processor> 
     161    </Compile> 
     162  </ItemGroup> 
     163  <ItemGroup> 
     164    <Compile Include="ObstacleC0.png"> 
     165      <Name>ObstacleC0</Name> 
     166      <Importer>TextureImporter</Importer> 
     167      <Processor>TextureProcessor</Processor> 
     168    </Compile> 
     169  </ItemGroup> 
     170  <ItemGroup> 
     171    <Compile Include="kentta3.txt"> 
     172      <Name>kentta3</Name> 
     173      <Importer>TextFileImporter</Importer> 
     174      <Processor>TextFileContentProcessor</Processor> 
     175    </Compile> 
     176  </ItemGroup> 
    113177  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    114178  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2017/27/PyryS/GravityAssist/GravityAssist/GravityAssistContent/kentta1.txt

    r8896 r8917  
    1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 
    2           ,,,,,,,,,,,,,,,,,, 
    3                   
    4  N       ................... 
    5 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV 
     1AAAAAAAAAAAAAAAAAAAAAAAAAAA 
     2                 , , ,  
     3             + 
     4     . . . 
     5VVVVVVVVVVVVVVVVVVVVVVVVVVV 
Note: See TracChangeset for help on using the changeset viewer.