Changeset 4099 for 2013/24


Ignore:
Timestamp:
2013-06-12 15:02:33 (10 years ago)
Author:
alvirmas
Message:

Talletus.

Location:
2013/24/AleksanteriV/Protokolla236/Protokolla236
Files:
36 added
7 edited

Legend:

Unmodified
Added
Removed
  • 2013/24/AleksanteriV/Protokolla236/Protokolla236/Protokolla236/Protokolla236.cs

    r4079 r4099  
    99public class Protokolla236 : PhysicsGame 
    1010{ 
    11     private Image[] tasoanim = LoadImages("taso1", "taso1.1", "taso1.2", "taso1.3", "taso1", "taso1", "taso1.3", "taso1", "taso1.1"); 
    12     private Image[] liekkianim = LoadImages("liekki1.1","liekki1.2"); 
    13     Image tausta = LoadImage("tausta01"); 
     11     
     12    Image tausta = LoadImage("tausta02"); 
     13 
    1414    Image pelaajankuva = LoadImage("pelaaja1.0"); 
     15 
    1516    Image taso2 = LoadImage("taso2"); 
    1617    Image taso3 = LoadImage("taso3"); 
    1718    Image taso4 = LoadImage("taso4"); 
     19    private Image[] tasoanim = LoadImages("taso1", "taso1.1", "taso1.2", "taso1.3", "taso1", "taso1", "taso1.3", "taso1", "taso1.1"); 
     20    private Image[] liekkianim = LoadImages("liekki1.1", "liekki1.2"); 
     21    private Image[] taso5anim = LoadImages("taso5.1", "taso5.2", "taso5.3", "taso5.4", "taso5.5", "taso5.6", "taso5.7"); 
     22 
     23    Image Block021 = LoadImage("Block2.1"); 
     24    Image BlockMusta = LoadImage("Blockmusta"); 
     25    Image Blocklasi = LoadImage("Blocklasi"); 
     26    Image Block121 = LoadImage("Block121"); 
     27 
     28    private Image[] vihu1 = LoadImages("vihu01","vihu02"); 
     29    private Image[] vihu2 = LoadImages("vihu05","vihu051","vihu052","vihu053","vihu054"); 
     30    private Image[] vihu3 = LoadImages("vihu031", "vihu032", "vihu033"); 
     31    private Image[] vihu4 = LoadImages("vihu041", "vihu042", "vihu043","vihu042"); 
     32 
    1833    private Image[] tasoliekkianim = LoadImages("taso23.1","taso23.2","taso23.3"); 
    1934    private Image[] Blockanim = LoadImages("Block1.1","Block1.2","Block1.3","Block1.2"); 
     35    SoundEffect raketti = LoadSoundEffect("raketti"); 
     36    AssaultRifle pelaajan1Ase; 
     37    private Image[] ammusanim = LoadImages("ammus","ammus2"); 
     38 
     39    private string[] soitin = { "nitrome - bullethead", "nitrome - enemy 585 3", "nitrome - N.M.D" }; 
     40 
     41 
    2042    public override void Begin() 
    2143    { 
     
    2547 
    2648        Gravity = new Vector(0.0, -200.0); 
    27          
     49        Level.CreateBorders(0.5, true); 
     50 
     51         
     52        MediaPlayer.Play(soitin[RandomGen.NextInt(0,soitin.Length)]); 
     53        MediaPlayer.IsRepeating = true; 
     54 
    2855         
    2956         
     
    3764    { 
    3865        ColorTileMap ruudut = ColorTileMap.FromLevelAsset("kentta2"); 
    39  
     66        //478DFF 
    4067        ruudut.SetTileMethod(Color.FromHexCode("00FF00"), luopelaaja); 
    41         ruudut.SetTileMethod(Color.FromHexCode("000000"), luotaso, new Animation(tasoliekkianim)); 
     68        ruudut.SetTileMethod(Color.FromHexCode("000000"), luotaso, new Animation(tasoanim)); 
    4269        ruudut.SetTileMethod(Color.FromHexCode("FFFF00"), luotaso, (Animation)taso3); 
    4370        ruudut.SetTileMethod(Color.FromHexCode("54FFEB"), luotaso, (Animation)taso4); 
    44         ruudut.SetTileMethod(Color.FromHexCode("0000FF"), luotaso, new Animation(tasoanim)); 
     71        ruudut.SetTileMethod(Color.FromHexCode("FF0087"), luotaso, new Animation(taso5anim)); 
     72        ruudut.SetTileMethod(Color.FromHexCode("0000FF"), luotaso, new Animation(tasoliekkianim)); 
     73        ruudut.SetTileMethod(Color.FromHexCode("D9FF93"), luotaso, (Animation)Blocklasi); 
    4574        ruudut.SetTileMethod(Color.FromHexCode("FF42C0"), luotausta, new Animation(Blockanim)); 
     75        ruudut.SetTileMethod(Color.FromHexCode("42B9FF"), luotausta, (Animation)BlockMusta); 
     76        ruudut.SetTileMethod(Color.FromHexCode("00FF90"), luotausta, (Animation)Block021); 
     77        ruudut.SetTileMethod(Color.FromHexCode("478DFF"), luotausta, (Animation)Block121); 
     78        ruudut.SetTileMethod(Color.FromHexCode("FF0000"), luovihu, new Animation(vihu2)); 
     79        ruudut.SetTileMethod(Color.FromHexCode("FF5700"), luovihu, new Animation(vihu3)); 
     80        ruudut.SetTileMethod(Color.FromHexCode("FF5711"), luovihu, new Animation(vihu4)); 
    4681        ruudut.Execute(50, 50); 
    4782    } 
     
    6297        GameObject Block = new GameObject(50, 50); 
    6398        Block.Position = paikka; 
    64         Add(Block); 
     99        Add(Block, -2); 
    65100        Block.Animation = kuva; 
    66101        Block.Animation.Start(); 
    67         Block.Animation.FPS = RandomGen.NextDouble(3.0, 7.0); 
     102        Block.Animation.FPS = 5; 
    68103    } 
    69104 
     
    78113        pelaaja1.Shape = Shape.FromImage(pelaajankuva); 
    79114        pelaaja1.Tag = "pelaaja"; 
     115        pelaaja1.Restitution = 0.5; 
    80116        Add(pelaaja1, 1); 
     117 
     118        pelaajan1Ase = new AssaultRifle(30, 10); 
     119        pelaajan1Ase.IsVisible = false; 
     120        pelaajan1Ase.Angle = Angle.RightAngle; 
     121        //Ammusten määrä aluksi: 
     122        pelaajan1Ase.Ammo.Value = 1000; 
     123        pelaajan1Ase.Power.DefaultValue = 100; 
     124        //Mitä tapahtuu kun ammus osuu johonkin? 
     125        pelaajan1Ase.ProjectileCollision = AmmusOsui; 
     126 
     127        pelaaja1.Add(pelaajan1Ase); 
    81128 
    82129        GameObject liekki = new GameObject(50, 50); 
     
    100147        Keyboard.Listen(Key.Up, ButtonState.Down, 
    101148          LiikutaPelaajaa, null, 1000.0, pelaaja1); 
     149        Keyboard.Listen(Key.Space, ButtonState.Down, 
     150            AmmuAseella, null, pelaajan1Ase); 
     151             
    102152        /*Keyboard.Listen(Key.Down, ButtonState.Down, 
    103153          LiikutaPelaajaa, null, -1000, pelaaja1);*/ 
     
    107157        Keyboard.Listen(Key.Up, ButtonState.Released, 
    108158         liekkianimaatio, null, liekki,false); 
    109      }  
     159     } 
     160    void AmmuAseella(AssaultRifle ase) 
     161    { 
     162        PhysicsObject ammus = ase.Shoot(); 
     163 
     164        if (ammus != null) 
     165        { 
     166            ammus.Angle = ase.AbsoluteAngle -Angle.RightAngle; 
     167            ammus.Size *= 3; 
     168            ammus.Animation = new Animation (ammusanim); 
     169            ammus.Animation.Start(); 
     170            ammus.Animation.FPS = 3; 
     171             
     172            //ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
     173        } 
     174    } 
     175    void AmmusOsui(PhysicsObject ammus, PhysicsObject kohde) 
     176    { 
     177        ammus.Destroy(); 
     178        if (kohde.Tag.ToString() == "vihu") 
     179        { 
     180            kohde.Destroy(); 
     181        } 
     182    } 
    110183 
    111184    void liekkianimaatio(GameObject liekki, bool totuus) 
    112185    { 
    113186        liekki.IsVisible = totuus; 
     187        if (totuus) 
     188        { 
     189             
     190            if(!raketti.IsPlaying) 
     191            { 
     192                raketti.Play(); 
     193            } 
     194        } 
     195        else 
     196        { 
     197            raketti.Stop(); 
     198        } 
    114199    } 
    115200 
     
    128213    } 
    129214 
     215    void luovihu(Vector paikka, double leveys, double korkeus, Animation kuva)  
     216    { 
     217        PhysicsObject vihu = new PhysicsObject(50, 50); 
     218        vihu.Shape = Shape.Circle;    //FromImage(kuva); 
     219        vihu.Animation = kuva; 
     220        vihu.Position = paikka; 
     221        vihu.Tag = "vihu"; 
     222        vihu.IgnoresGravity = true; 
     223        Add(vihu, 1); 
     224        RandomMoverBrain satunnaisAivot = new RandomMoverBrain(50); 
     225        satunnaisAivot.ChangeMovementSeconds = 5; 
     226        vihu.Brain = satunnaisAivot; 
     227        vihu.Animation.Start(); 
     228        vihu.Animation.FPS = 4; 
     229         
     230    } 
     231 
     232 
     233 
    130234 
    131235} 
  • 2013/24/AleksanteriV/Protokolla236/Protokolla236/Protokolla236Content/Protokolla236Content.contentproj

    r4079 r4099  
    179179    </Compile> 
    180180  </ItemGroup> 
     181  <ItemGroup> 
     182    <Compile Include="raketti.mp3"> 
     183      <Name>raketti</Name> 
     184      <Importer>Mp3Importer</Importer> 
     185      <Processor>SoundEffectProcessor</Processor> 
     186    </Compile> 
     187  </ItemGroup> 
     188  <ItemGroup> 
     189    <Compile Include="nitrome - bullethead.mp3"> 
     190      <Name>nitrome - bullethead</Name> 
     191      <Importer>Mp3Importer</Importer> 
     192      <Processor>SongProcessor</Processor> 
     193    </Compile> 
     194  </ItemGroup> 
     195  <ItemGroup> 
     196    <Compile Include="Blockmusta.png"> 
     197      <Name>Blockmusta</Name> 
     198      <Importer>TextureImporter</Importer> 
     199      <Processor>TextureProcessor</Processor> 
     200    </Compile> 
     201  </ItemGroup> 
     202  <ItemGroup> 
     203    <Compile Include="tausta001.png"> 
     204      <Name>tausta001</Name> 
     205      <Importer>TextureImporter</Importer> 
     206      <Processor>TextureProcessor</Processor> 
     207    </Compile> 
     208  </ItemGroup> 
     209  <ItemGroup> 
     210    <Compile Include="tausta02.png"> 
     211      <Name>tausta02</Name> 
     212      <Importer>TextureImporter</Importer> 
     213      <Processor>TextureProcessor</Processor> 
     214    </Compile> 
     215  </ItemGroup> 
     216  <ItemGroup> 
     217    <Compile Include="Blocklasi.png"> 
     218      <Name>Blocklasi</Name> 
     219      <Importer>TextureImporter</Importer> 
     220      <Processor>TextureProcessor</Processor> 
     221    </Compile> 
     222  </ItemGroup> 
     223  <ItemGroup> 
     224    <Compile Include="Block121.png"> 
     225      <Name>Block121</Name> 
     226      <Importer>TextureImporter</Importer> 
     227      <Processor>TextureProcessor</Processor> 
     228    </Compile> 
     229  </ItemGroup> 
     230  <ItemGroup> 
     231    <Compile Include="vihu01.png"> 
     232      <Name>vihu01</Name> 
     233      <Importer>TextureImporter</Importer> 
     234      <Processor>TextureProcessor</Processor> 
     235    </Compile> 
     236  </ItemGroup> 
     237  <ItemGroup> 
     238    <Compile Include="vihu02.png"> 
     239      <Name>vihu02</Name> 
     240      <Importer>TextureImporter</Importer> 
     241      <Processor>TextureProcessor</Processor> 
     242    </Compile> 
     243    <Compile Include="vihu05.png"> 
     244      <Name>vihu05</Name> 
     245      <Importer>TextureImporter</Importer> 
     246      <Processor>TextureProcessor</Processor> 
     247    </Compile> 
     248    <Compile Include="vihu051.png"> 
     249      <Name>vihu051</Name> 
     250      <Importer>TextureImporter</Importer> 
     251      <Processor>TextureProcessor</Processor> 
     252    </Compile> 
     253    <Compile Include="vihu052.png"> 
     254      <Name>vihu052</Name> 
     255      <Importer>TextureImporter</Importer> 
     256      <Processor>TextureProcessor</Processor> 
     257    </Compile> 
     258    <Compile Include="vihu053.png"> 
     259      <Name>vihu053</Name> 
     260      <Importer>TextureImporter</Importer> 
     261      <Processor>TextureProcessor</Processor> 
     262    </Compile> 
     263    <Compile Include="vihu054.png"> 
     264      <Name>vihu054</Name> 
     265      <Importer>TextureImporter</Importer> 
     266      <Processor>TextureProcessor</Processor> 
     267    </Compile> 
     268  </ItemGroup> 
     269  <ItemGroup> 
     270    <Compile Include="taso5.1.png"> 
     271      <Name>taso5.1</Name> 
     272      <Importer>TextureImporter</Importer> 
     273      <Processor>TextureProcessor</Processor> 
     274    </Compile> 
     275    <Compile Include="taso5.2.png"> 
     276      <Name>taso5.2</Name> 
     277      <Importer>TextureImporter</Importer> 
     278      <Processor>TextureProcessor</Processor> 
     279    </Compile> 
     280    <Compile Include="taso5.3.png"> 
     281      <Name>taso5.3</Name> 
     282      <Importer>TextureImporter</Importer> 
     283      <Processor>TextureProcessor</Processor> 
     284    </Compile> 
     285    <Compile Include="taso5.4.png"> 
     286      <Name>taso5.4</Name> 
     287      <Importer>TextureImporter</Importer> 
     288      <Processor>TextureProcessor</Processor> 
     289    </Compile> 
     290    <Compile Include="taso5.5.png"> 
     291      <Name>taso5.5</Name> 
     292      <Importer>TextureImporter</Importer> 
     293      <Processor>TextureProcessor</Processor> 
     294    </Compile> 
     295    <Compile Include="taso5.6.png"> 
     296      <Name>taso5.6</Name> 
     297      <Importer>TextureImporter</Importer> 
     298      <Processor>TextureProcessor</Processor> 
     299    </Compile> 
     300    <Compile Include="taso5.7.png"> 
     301      <Name>taso5.7</Name> 
     302      <Importer>TextureImporter</Importer> 
     303      <Processor>TextureProcessor</Processor> 
     304    </Compile> 
     305  </ItemGroup> 
     306  <ItemGroup> 
     307    <Compile Include="ammus2.png"> 
     308      <Name>ammus2</Name> 
     309      <Importer>TextureImporter</Importer> 
     310      <Processor>TextureProcessor</Processor> 
     311    </Compile> 
     312  </ItemGroup> 
     313  <ItemGroup> 
     314    <Compile Include="ammus.png"> 
     315      <Name>ammus</Name> 
     316      <Importer>TextureImporter</Importer> 
     317      <Processor>TextureProcessor</Processor> 
     318    </Compile> 
     319  </ItemGroup> 
     320  <ItemGroup> 
     321    <Compile Include="vihu031.png"> 
     322      <Name>vihu031</Name> 
     323      <Importer>TextureImporter</Importer> 
     324      <Processor>TextureProcessor</Processor> 
     325    </Compile> 
     326    <Compile Include="vihu032.png"> 
     327      <Name>vihu032</Name> 
     328      <Importer>TextureImporter</Importer> 
     329      <Processor>TextureProcessor</Processor> 
     330    </Compile> 
     331    <Compile Include="vihu033.png"> 
     332      <Name>vihu033</Name> 
     333      <Importer>TextureImporter</Importer> 
     334      <Processor>TextureProcessor</Processor> 
     335    </Compile> 
     336  </ItemGroup> 
     337  <ItemGroup> 
     338    <Compile Include="vihu041.png"> 
     339      <Name>vihu041</Name> 
     340      <Importer>TextureImporter</Importer> 
     341      <Processor>TextureProcessor</Processor> 
     342    </Compile> 
     343    <Compile Include="vihu042.png"> 
     344      <Name>vihu042</Name> 
     345      <Importer>TextureImporter</Importer> 
     346      <Processor>TextureProcessor</Processor> 
     347    </Compile> 
     348    <Compile Include="vihu043.png"> 
     349      <Name>vihu043</Name> 
     350      <Importer>TextureImporter</Importer> 
     351      <Processor>TextureProcessor</Processor> 
     352    </Compile> 
     353  </ItemGroup> 
     354  <ItemGroup> 
     355    <Compile Include="lasershot.mp3"> 
     356      <Name>lasershot</Name> 
     357      <Importer>Mp3Importer</Importer> 
     358      <Processor>SongProcessor</Processor> 
     359    </Compile> 
     360  </ItemGroup> 
     361  <ItemGroup> 
     362    <Compile Include="nitrome - enemy 585 3.mp3"> 
     363      <Name>nitrome - enemy 585 3</Name> 
     364      <Importer>Mp3Importer</Importer> 
     365      <Processor>SongProcessor</Processor> 
     366    </Compile> 
     367    <Compile Include="nitrome - N.M.D.mp3"> 
     368      <Name>nitrome - N.M.D</Name> 
     369      <Importer>Mp3Importer</Importer> 
     370      <Processor>SongProcessor</Processor> 
     371    </Compile> 
     372  </ItemGroup> 
    181373  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    182374  <!--  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.