Changeset 3590 for 2012/27


Ignore:
Timestamp:
2012-07-05 14:23:33 (11 years ago)
Author:
jumakall
Message:
 
Location:
2012/27/JuhoK
Files:
3 added
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • 2012/27/JuhoK/Impossible/Impossible/Impossible/Impossible.cs

    r3587 r3590  
    1111    double moveSpeed = 1600; 
    1212    bool allowMove = false; 
    13     int kenttaNro = 1; 
     13    bool nextLevel = true; 
     14    int kenttaNro = 0; 
     15    int kenttaMax = 1; 
    1416 
    1517    PlatformCharacter cube; 
     
    2325    Vector currPos; 
    2426    Vector prevPos; 
     27 
     28    ExplosionSystem es; 
    2529 
    2630    public override void Begin() 
     
    4953                allowMove = false; 
    5054                createExplosion(cube.Position); 
     55                MediaPlayer.Stop(); 
    5156                cube.Destroy(); 
    5257            } 
     
    6267    { 
    6368        ClearAll(); 
    64         Level.Background.Image = LoadImage("background"); 
    65         LuoKentta(kenttaNro); 
    66         Level.Background.FitToLevel(); 
    67  
    68         Keyboard.Listen(Key.Space, ButtonState.Down, jump, null); 
    69         Keyboard.Listen(Key.Enter, ButtonState.Pressed, startGame, null); 
    70  
    71         Gravity = new Vector(0, -7500); 
    72  
    73          Camera.Follow(pelaajanHaamu); 
    74         Camera.StayInLevel = true; 
    75         //Camera.ZoomToLevel(); 
    76         Camera.ZoomFactor = 0.3; 
     69 
     70        es = new ExplosionSystem(LoadImage("explosion"), 100); 
     71        Add(es); 
     72 
     73        if (nextLevel == true) { kenttaNro++; nextLevel = false; } 
     74        if (kenttaNro <= kenttaMax) 
     75        { 
     76            Level.Background.Image = LoadImage("background"); 
     77            LuoKentta(kenttaNro); 
     78            Level.Background.FitToLevel(); 
     79 
     80            Keyboard.Listen(Key.Space, ButtonState.Down, jump, null); 
     81            Keyboard.Listen(Key.Enter, ButtonState.Pressed, startGame, null); 
     82 
     83            Gravity = new Vector(0, -7500); 
     84 
     85            Camera.Follow(pelaajanHaamu); 
     86            Camera.StayInLevel = true; 
     87            //Camera.ZoomToLevel(); 
     88            Camera.ZoomFactor = 0.3; 
     89            MediaPlayer.Play("track"+kenttaNro); 
     90        } 
     91        else { gameOver(); } 
    7792 
    7893    } 
     
    120135        Piikki.Position = paikka; 
    121136        Piikki.Image = piikinKuva; 
    122         Piikki.Shape = Shape.Triangle; 
     137        Piikki.Shape = Shape.FromImage(piikinKuva); 
    123138        Piikki.Color = Color.Pink; 
     139        Piikki.Tag = "piikki"; 
    124140        Add(Piikki); 
    125141    } 
     
    135151        Add(cube); 
    136152        allowMove = true; 
     153        AddCollisionHandler(cube, cubeCollision); 
    137154 
    138155        pelaajanHaamu = new GameObject(leveys, korkeus);         
     
    148165        palikka.Shape = Shape.Rectangle; 
    149166        palikka.Color = Color.Gray; 
     167        palikka.Tag = "maali"; 
    150168        Add(palikka); 
    151169    } 
     
    164182 
    165183    void createExplosion(Vector position) 
    166     { 
    167         Explosion explosion = new Explosion(100); 
    168         explosion.Position = position; 
    169         explosion.Size = new Vector(50, 50); 
    170         explosion.Speed = 1; 
    171         Add(explosion); 
     184    {         
     185        es.AddEffect(position, 100); 
     186    } 
     187 
     188    void cubeCollision(PhysicsObject tormaaja, PhysicsObject kohde) 
     189    { 
     190        if (kohde.Tag.ToString() == "piikki") 
     191        { 
     192            createExplosion(cube.Position); 
     193            MediaPlayer.Stop(); 
     194            cube.Destroy(); 
     195            allowMove = false; 
     196        } 
     197        else if (kohde.Tag.ToString() == "maali") 
     198        { 
     199            MessageDisplay.Add("Next level reached!"); 
     200            nextLevel = true; 
     201            startGame(); 
     202        } 
     203    } 
     204 
     205    void gameOver() 
     206    { 
     207        Level.BackgroundColor = Color.Pink; 
     208        MessageDisplay.Add("OutOfMemoryExeption; GAME ABORTED!"); 
    172209    } 
    173210} 
  • 2012/27/JuhoK/Impossible/Impossible/Impossible/Impossible.csproj.Debug.cachefile

    r3587 r3590  
    55Content\viiva.xnb 
    66Content\background.xnb 
     7Content\explosion.xnb 
     8Content\track1.xnb 
     9Content\exp.xnb 
     10Content\track1.wma 
    711Content\piikki.png 
  • 2012/27/JuhoK/Impossible/Impossible/ImpossibleContent/ImpossibleContent.contentproj

    r3587 r3590  
    8787    </Compile> 
    8888  </ItemGroup> 
     89  <ItemGroup> 
     90    <Compile Include="explosion.png"> 
     91      <Name>explosion</Name> 
     92      <Importer>TextureImporter</Importer> 
     93      <Processor>TextureProcessor</Processor> 
     94    </Compile> 
     95  </ItemGroup> 
     96  <ItemGroup> 
     97    <Compile Include="track1.mp3"> 
     98      <Name>track1</Name> 
     99      <Importer>Mp3Importer</Importer> 
     100      <Processor>SongProcessor</Processor> 
     101    </Compile> 
     102  </ItemGroup> 
    89103  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    90104  <!--  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.