Changeset 5599 for 2014/30


Ignore:
Timestamp:
2014-07-23 15:03:41 (9 years ago)
Author:
athebla
Message:

Peli päivitetty + lisää tekstuureita #2

Location:
2014/30/AtteB
Files:
55 added
16 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/AtteB/Peli/Peli/Peli/Peli.cs

    r5577 r5599  
    77using Jypeli.Widgets; 
    88 
    9 class Vihollinen : PhysicsObject 
     9class Vihollinen : PlatformCharacter 
    1010{ 
    11     private IntMeter elamaLaskuri = new IntMeter(3, 0, 3); 
     11    private IntMeter elamaLaskuri; 
    1212    public IntMeter ElamaLaskuri { get { return elamaLaskuri; } } 
    1313 
    14     public Vihollinen(double leveys, double korkeus) 
     14    public Vihollinen(double leveys, double korkeus, int elama) 
    1515        : base(leveys, korkeus) 
    1616    { 
     17        elamaLaskuri = new IntMeter(elama, 0, elama); 
    1718        elamaLaskuri.LowerLimit += delegate { this.Destroy(); }; 
    1819    } 
     
    5960 
    6061    PlatformCharacter pelaaja1; 
     62    PhysicsObject Vihollinen; 
     63    Vihollinen Slime; 
    6164 
    6265    Image tahtiKuva = LoadImage("tahti"); 
     
    7477    Image Clear = LoadImage("Clear"); 
    7578    Image Heart1 = LoadImage("heart"); 
     79    Image SlimeBall = LoadImage("SlimeBall"); 
    7680 
    7781    SoundEffect maaliAani = LoadSoundEffect("maali"); 
    7882    SoundEffect HowItBegins = LoadSoundEffect("HowItBegins"); 
     83    SoundEffect PlayerShoot1 = LoadSoundEffect("PlayerShoot"); 
    7984 
    8085    public override void Begin() 
     
    8792        LuoKentta(); 
    8893        LisaaNappaimet(); 
     94        LuoElämäLaskuri(); 
    8995 
    9096        Camera.Follow(pelaaja1); 
     
    96102        Inventory inventory = new Inventory(); 
    97103        Add(inventory); 
     104 
     105        Camera.FollowedObject = pelaaja1; 
     106        Camera.Zoom(1.5); 
     107 
     108        MediaPlayer.Play("howitbegins"); 
    98109    } 
    99110 
     
    167178        pelaaja1.Position = paikka; 
    168179        pelaaja1.Mass = 10.0; 
     180        pelaaja1.Tag = "pelaaja"; 
    169181        pelaaja1.Image = Pelaaja_Seisoo; 
    170182        AddCollisionHandler(pelaaja1, "vihollinen", PelaajaOsuuViholliseen); 
     
    182194 
    183195        pelaaja1.Add(P1FireBall); 
     196 
     197        P1FireBall.AttackSound = null; 
    184198    } 
    185199 
     
    219233        vihollinen.Position = paikka; 
    220234        vihollinen.Tag = "vihollinen"; 
     235        //AddCollisionHandler(vihollinen, "ammus", AmmusOsuiViholliseen); 
    221236        Add(vihollinen); 
    222237    } 
     
    232247    public void PelaajaOsuuViholliseen(PhysicsObject pelaaja1, PhysicsObject kohde) 
    233248    { 
    234         elämäLaskuri.Value -= elämäLaskuri - 10; 
     249        elämäLaskuri.Value -= 10; 
    235250 
    236251        if (elämäLaskuri <= 0) 
     
    240255    public void PelaajaOsuuHeart(PhysicsObject pelaaja1, PhysicsObject kohde) 
    241256    { 
    242         elämäLaskuri.Value += elämäLaskuri + 20; 
     257        if (elämäLaskuri <= elämäLaskuri.MaxValue - 10) 
     258        { 
     259            elämäLaskuri.Value += elämäLaskuri + 20; 
     260            kohde.Destroy(); 
     261        } 
    243262    } 
    244263 
    245264    void LuoSlime(Vector paikka, double leveys, double korkeus) 
    246265    { 
    247         PhysicsObject Slime = new PhysicsObject(leveys, korkeus); 
     266        Vihollinen Slime = new Vihollinen(leveys, korkeus * 0.5, 5); 
    248267        Slime.CanRotate = false; 
    249268        Slime.Position = paikka; 
     
    251270        Slime.Image = Slime1; 
    252271        Add(Slime); 
     272         
     273        PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 
     274        tasoAivot.Speed = 150; 
     275        Slime.Brain = tasoAivot; 
     276         
     277        FollowerBrain SlimeAivot = new FollowerBrain("pelaaja"); 
     278        SlimeAivot.Speed = 200; 
     279        SlimeAivot.DistanceFar = 600; 
     280        SlimeAivot.DistanceClose = 300; 
     281        SlimeAivot.StopWhenTargetClose = true; 
     282        SlimeAivot.FarBrain = tasoAivot; 
     283 
     284        Slime.Weapon = new AssaultRifle(30, 10); 
     285        Slime.Weapon.ProjectileCollision = AmmusOsuiPelaajaan; 
     286        Slime.Weapon.IsVisible = true; 
     287        Slime.Weapon.AttackSound = null; 
     288 
     289        Timer ajastin = new Timer(); 
     290        ajastin.Interval = 0.5; 
     291        ajastin.Timeout += delegate 
     292        { 
     293            PhysicsObject ammus = Slime.Weapon.Shoot(); 
     294            if (ammus != null) 
     295            { 
     296                ammus.Image = SlimeBall; 
     297                ammus.Size = new Vector(20, 20); 
     298                ammus.MaximumLifetime = TimeSpan.FromSeconds(1.0); 
     299                ammus.Tag = "ammus"; 
     300 
     301            } 
     302        }; 
     303        ajastin.Start(); 
     304 
     305        Timer ajastin2 = new Timer(); 
     306        ajastin2.Interval = 0.01; 
     307        ajastin2.Timeout += delegate 
     308        { 
     309 
     310            Vector suunta = (pelaaja1.Position - Slime.Position).Normalize(); 
     311            Slime.Weapon.Angle = suunta.Angle; 
     312 
     313        }; 
     314        ajastin2.Start(); 
     315    } 
     316 
     317    void LuoBoss1(Vector paikka, double leveys, double korkeus) 
     318    { 
     319        Vihollinen Boss1 = new Vihollinen(leveys, korkeus * 0.5, 20); 
     320        Boss1.CanRotate = false; 
     321        Boss1.Position = paikka; 
     322        Boss1.Tag = "vihollinen"; 
     323        Boss1.Image = Slime1; 
     324        Add(Boss1); 
     325 
     326        PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 
     327        tasoAivot.Speed = 150; 
     328        Boss1.Brain = tasoAivot; 
     329 
     330        FollowerBrain SlimeAivot = new FollowerBrain("vihollinen"); 
     331        SlimeAivot.Speed = 200; 
     332        SlimeAivot.DistanceFar = 600; 
     333        SlimeAivot.DistanceClose = 300; 
     334        SlimeAivot.StopWhenTargetClose = true; 
     335        SlimeAivot.FarBrain = tasoAivot; 
     336 
     337        Boss1.Weapon = new AssaultRifle(30, 10); 
     338        Boss1.Weapon.ProjectileCollision = AmmusOsuiPelaajaan; 
     339        Boss1.Weapon.IsVisible = false; 
     340        Boss1.Weapon.AttackSound = null; 
     341 
     342        Timer ajastin = new Timer(); 
     343        ajastin.Interval = 1.0; 
     344        ajastin.Timeout += delegate 
     345        { 
     346            PhysicsObject ammus = Boss1.Weapon.Shoot(); 
     347            if (ammus != null) 
     348            { 
     349                ammus.Image = SlimeBall; 
     350                ammus.Size = new Vector(20, 20); 
     351                ammus.MaximumLifetime = TimeSpan.FromSeconds(1.0); 
     352                ammus.Tag = "ammus"; 
     353            } 
     354        }; 
     355        ajastin.Start(); 
     356        if (Boss1.IsDestroyed) 
     357        { 
     358            ajastin.Stop(); 
     359        } 
    253360    } 
    254361 
     
    257364        ammus.Destroy(); 
    258365 
     366        if (kohde.Tag.ToString() == "vihollinen") 
     367        { 
     368            (kohde as Vihollinen).ElamaLaskuri.Value--; 
     369        } 
     370    } 
     371 
     372    void AmmusOsuiPelaajaan(PhysicsObject ammus, PhysicsObject kohde) 
     373    { 
     374        ammus.Destroy(); 
     375 
     376        if (kohde.Tag.ToString() == "pelaaja") 
     377        { 
     378            elämäLaskuri.Value--; 
     379        } 
    259380    } 
    260381 
    261382    void AmmuAseella(AssaultRifle ase) 
    262383    { 
     384        ase.AbsoluteAngle = pelaaja1.FacingDirection.Angle; 
    263385        PhysicsObject ammus = ase.Shoot(); 
    264386 
     
    268390            ammus.Size = new Vector(40, 40); 
    269391            ammus.MaximumLifetime = TimeSpan.FromSeconds(2.0); 
     392            ammus.Tag = "ammus"; 
    270393        } 
    271394    } 
     
    283406 
    284407        ProgressBar elämäPalkki = new ProgressBar(150, 20); 
    285         elämäPalkki.X = Screen.Left + 150; 
    286         elämäPalkki.Y = Screen.Top - 20; 
     408        elämäPalkki.X = Screen.Left + 500; 
     409        elämäPalkki.Y = Screen.Top - 100; 
    287410        elämäPalkki.BindTo(elämäLaskuri); 
    288411        elämäPalkki.Color = Color.Transparent; 
     
    294417    void ElämäLoppui() 
    295418    { 
     419        Explosion PelaajaRäjähtää = new Explosion(200); 
     420        PelaajaRäjähtää.Position = pelaaja1.Position; 
     421        PelaajaRäjähtää.Sound = null; 
     422        Add(PelaajaRäjähtää); 
     423 
    296424        MessageDisplay.Add("Elämät loppuivat, voi voi."); 
    297         Remove(pelaaja1); 
     425        pelaaja1.Destroy(); 
     426 
     427        Timer.SingleShot(4.0, AloitaPeliAlusta); 
     428    } 
     429 
     430    public void SlimeLähelläPelaajaa() 
     431    { 
     432        Vector suunta = (pelaaja1.Position - Slime.Position).Normalize(); 
     433 
     434        Slime.Angle = suunta.Angle; 
     435    } 
     436 
     437    void AloitaPeliAlusta() 
     438    { 
     439        ClearAll(); 
     440        Begin(); 
    298441    } 
    299442 
  • 2014/30/AtteB/Peli/Peli/Peli/Peli.csproj.Debug.cachefile

    r5577 r5599  
    1717Content\Fireball_4.xnb 
    1818Content\Clear.xnb 
     19Content\HowItBegins.xnb 
    1920Content\heart.xnb 
    20 Content\HowItBegins.xnb 
     21Content\Slimeball.xnb 
     22Content\PlayerShoot.xnb 
    2123Content\HowItBegins.wma 
     24Content\PlayerShoot.wma 
  • 2014/30/AtteB/Peli/Peli/Peli/obj/x86/Debug/ContentPipeline-{2D86B228-748C-44C7-93B1-DCBD6910317C}.xml

    r5577 r5599  
    3636      <Options>None</Options> 
    3737      <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\kentta1.xnb</Output> 
    38       <Time>2014-07-23T11:52:10.0873113+03:00</Time> 
     38      <Time>2014-07-23T13:24:51.8127339+03:00</Time> 
    3939    </Item> 
    4040    <Item> 
     
    117117      <Options>None</Options> 
    118118      <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Slime.xnb</Output> 
    119       <Time>2014-07-22T14:06:10.9162814+03:00</Time> 
     119      <Time>2014-07-23T13:43:22.1617577+03:00</Time> 
    120120    </Item> 
    121121    <Item> 
     
    163163      <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Clear.xnb</Output> 
    164164      <Time>2014-07-23T10:21:25.007312+03:00</Time> 
    165     </Item> 
    166     <Item> 
    167       <Source>heart.jpg</Source> 
    168       <Name>heart</Name> 
    169       <Importer>TextureImporter</Importer> 
    170       <Processor>TextureProcessor</Processor> 
    171       <Options>None</Options> 
    172       <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\heart.xnb</Output> 
    173       <Time>2014-07-23T12:02:01.4194386+03:00</Time> 
    174165    </Item> 
    175166    <Item> 
     
    182173      <Extra>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\HowItBegins.wma</Extra> 
    183174      <Time>2014-07-23T11:50:07.3910911+03:00</Time> 
     175    </Item> 
     176    <Item> 
     177      <Source>heart.png</Source> 
     178      <Name>heart</Name> 
     179      <Importer>TextureImporter</Importer> 
     180      <Processor>TextureProcessor</Processor> 
     181      <Options>None</Options> 
     182      <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\heart.xnb</Output> 
     183      <Time>2014-07-23T12:45:31.8687631+03:00</Time> 
     184    </Item> 
     185    <Item> 
     186      <Source>Slimeball.png</Source> 
     187      <Name>Slimeball</Name> 
     188      <Importer>TextureImporter</Importer> 
     189      <Processor>TextureProcessor</Processor> 
     190      <Options>None</Options> 
     191      <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Slimeball.xnb</Output> 
     192      <Time>2014-07-23T13:43:35.0980512+03:00</Time> 
     193    </Item> 
     194    <Item> 
     195      <Source>PlayerShoot.mp3</Source> 
     196      <Name>PlayerShoot</Name> 
     197      <Importer>Mp3Importer</Importer> 
     198      <Processor>SongProcessor</Processor> 
     199      <Options>None</Options> 
     200      <Output>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\PlayerShoot.xnb</Output> 
     201      <Extra>C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\PlayerShoot.wma</Extra> 
     202      <Time>2014-07-23T13:51:43.8689234+03:00</Time> 
    184203    </Item> 
    185204    <BuildSuccessful>true</BuildSuccessful> 
  • 2014/30/AtteB/Peli/Peli/Peli/obj/x86/Debug/Peli.csproj.FileListAbsolute.txt

    r5577 r5599  
    2828C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\HowItBegins.xnb 
    2929C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\HowItBegins.wma 
     30C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\Slimeball.xnb 
     31C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\PlayerShoot.xnb 
     32C:\MyTemp\AtteB\Peli\Peli\Peli\bin\x86\Debug\Content\PlayerShoot.wma 
  • 2014/30/AtteB/Peli/Peli/Peli/obj/x86/Debug/cachefile-{2D86B228-748C-44C7-93B1-DCBD6910317C}-targetpath.txt

    r5577 r5599  
    1717Content\Fireball_4.xnb 
    1818Content\Clear.xnb 
    19 Content\heart.xnb 
    2019Content\HowItBegins.xnb 
    2120Content\HowItBegins.wma 
     21Content\heart.xnb 
     22Content\Slimeball.xnb 
     23Content\PlayerShoot.xnb 
     24Content\PlayerShoot.wma 
  • 2014/30/AtteB/Peli/Peli/PeliContent/PeliContent.contentproj

    r5577 r5599  
    160160  </ItemGroup> 
    161161  <ItemGroup> 
    162     <Compile Include="heart.jpg"> 
     162    <Compile Include="HowItBegins.mp3"> 
     163      <Name>HowItBegins</Name> 
     164      <Importer>Mp3Importer</Importer> 
     165      <Processor>SongProcessor</Processor> 
     166    </Compile> 
     167  </ItemGroup> 
     168  <ItemGroup> 
     169    <Compile Include="heart.png"> 
    163170      <Name>heart</Name> 
    164171      <Importer>TextureImporter</Importer> 
     
    167174  </ItemGroup> 
    168175  <ItemGroup> 
    169     <Compile Include="HowItBegins.mp3"> 
    170       <Name>HowItBegins</Name> 
     176    <Compile Include="Slimeball.png"> 
     177      <Name>Slimeball</Name> 
     178      <Importer>TextureImporter</Importer> 
     179      <Processor>TextureProcessor</Processor> 
     180    </Compile> 
     181  </ItemGroup> 
     182  <ItemGroup> 
     183    <Compile Include="PlayerShoot.mp3"> 
     184      <Name>PlayerShoot</Name> 
    171185      <Importer>Mp3Importer</Importer> 
    172186      <Processor>SongProcessor</Processor> 
  • 2014/30/AtteB/Peli/Peli/PeliContent/kentta1.txt

    r5577 r5599  
    1 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
    2  
    3  
    4   
    5  N 
    6 ????? 
    7 ??????.......H.......................................... 
    8 ???????..............?.....?. 
    9 ????????.............?..S..?.                                   
    10 ########################################################### 
     1++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
     2............................? 
     3............................? 
     4............................? 
     5 N..........................? 
     6?????.......................? 
     7??????.......H.............. ........................... 
     8???????.............?....... . 
     9????????............?...S...?.                                  
     10#####################################   #################### 
     11............................................................ 
     12............................................................ 
     13............................................................ 
     14............................................................ 
     15............................................................ 
     16............................................................ 
     17............................................................ 
     18############################################################ 
Note: See TracChangeset for help on using the changeset viewer.