Changeset 5625 for 2014/30/AarniAR


Ignore:
Timestamp:
2014-07-24 11:25:52 (5 years ago)
Author:
aajualal
Message:

Bugs

Location:
2014/30/AarniAR/AdventureOfStarKid
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid.cs

    r5617 r5625  
    77using Jypeli.Widgets; 
    88 
     9class Vihu : PlatformCharacter 
     10{ 
     11    private IntMeter elamaLaskuri = new IntMeter(10, 0, 10); 
     12    public IntMeter ElamaLaskuri { get { return elamaLaskuri; } } 
     13 
     14    public Vihu(double leveys, double korkeus) 
     15        : base(leveys, korkeus) 
     16    { 
     17        elamaLaskuri.LowerLimit += delegate { this.Destroy(); }; 
     18    } 
     19} 
     20 
     21 
    922public class AdventureOfStarKid : PhysicsGame 
    1023{ 
     
    1427    private Image[] jumpinganimation = LoadImages("jumpinganimation"); 
    1528    private Image[] lifelost = LoadImages("LifeLost"); 
     29    private Image[] damage = LoadImages("Damage"); 
    1630    const double nopeus = 200; 
    1731    const double hyppyNopeus = 750; 
     
    2236 
    2337    PlatformCharacter pelaaja1; 
     38    bool invincible = false; 
    2439 
    2540    Image pelaajanKuva = LoadImage("Standinganimation"); 
     
    6984    void Lisaastumper(Vector paikka, double leveys, double korkeus) 
    7085    { 
    71         PhysicsObject tahti = PhysicsObject.CreateStaticObject(leveys, korkeus); 
    72         tahti.IgnoresCollisionResponse = false; 
    73         tahti.Position = paikka; 
    74         tahti.Image = tahtiKuva; 
    75         tahti.Tag = "stumper"; 
    76         Add(tahti); 
     86        Vihu stumper = new Vihu(leveys-4, korkeus-4); 
     87        stumper.IgnoresCollisionResponse = false; 
     88        stumper.Position = paikka; 
     89        stumper.Image = tahtiKuva; 
     90        stumper.Tag = "stumper"; 
     91        Add(stumper); 
     92        PlatformWandererBrain tasoAivot = new PlatformWandererBrain(); 
     93        tasoAivot.Speed = 200; 
     94 
     95        stumper.Brain = tasoAivot; 
     96 
    7797    } 
    7898 
     
    85105        AddCollisionHandler(pelaaja1, "stumper", TormaaTahteen); 
    86106        Add(pelaaja1); 
    87         pelaaja1.AnimWalk = new Animation(running); 
     107        pelaaja1.AnimWalk = new Animation(running, running); 
    88108        pelaaja1.AnimIdle = new Animation(shootinganimation); 
    89109        pelaaja1.AnimJump = new Animation(jumpinganimation); 
    90110        pelaaja1.AnimFall = new Animation(jumpinganimation); 
     111         
    91112        pelaajan1Ase = new PlasmaCannon(1.0, 1.0); 
    92113        pelaajan1Ase.InfiniteAmmo = true; 
     114        pelaajan1Ase.ProjectileCollision += AmmusOsuu; 
    93115        pelaaja1.Weapon = pelaajan1Ase; 
     116    } 
     117 
     118    void AmmusOsuu(PhysicsObject ammus, PhysicsObject kohde) 
     119    { 
     120        ammus.Destroy(); 
     121 
     122        if (kohde.Tag == "stumper") 
     123        { 
     124            (kohde as Vihu).ElamaLaskuri.Value--; 
     125        } 
    94126    } 
    95127 
     
    126158    void TormaaTahteen(PhysicsObject hahmo, PhysicsObject stumper) 
    127159    { 
    128         maaliAani.Play(); 
    129         MessageDisplay.Add("Ouch!"); 
    130         health.Value -= 2; 
    131          
     160        if (!invincible) 
     161        { 
     162            maaliAani.Play(); 
     163            MessageDisplay.Add("Ouch!"); 
     164            health.Value -= 2; 
     165        } 
    132166        //stumper.Destroy(); 
    133167    } 
     168 
    134169    void Ammu(PlasmaCannon Ase) 
    135170    { 
     
    138173        pelaaja1.Animation.Start(); 
    139174    } 
     175 
    140176    void LuoPistelaskuri() 
    141177    { 
     
    144180        health.MinValue = 0; 
    145181        health.LowerLimit += PelaajaHaviaa; 
    146         /* 
     182         
    147183        health.Changed += delegate 
    148184        { 
    149             Animation anim = new Animation(lifelost); 
    150             anim.FPS = 2.0; 
     185            Animation anim = new Animation(damage); 
     186            anim.FPS = 6.0; 
    151187            pelaaja1.PlayAnimation(anim); 
     188            invincible = true; 
     189            Timer.SingleShot(1, delegate { invincible = false; }); 
    152190        }; 
    153          */ 
     191         
    154192        ProgressBar healthMeter = new ProgressBar(150, 20); 
    155193        healthMeter.X = Screen.Left + 150; 
  • 2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid.csproj.Debug.cachefile

    r5617 r5625  
    1010Content\jumpinganimation.xnb 
    1111Content\LifeLost.xnb 
     12Content\Damage.xnb 
  • 2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid/obj/x86/Debug/AdventureOfStarKid.csproj.FileListAbsolute.txt

    r5617 r5625  
    1818C:\MyTemp\AarniAR\AdventureOfStarKid\AdventureOfStarKid\AdventureOfStarKid\bin\x86\Debug\Content\jumpinganimation.xnb 
    1919C:\MyTemp\AarniAR\AdventureOfStarKid\AdventureOfStarKid\AdventureOfStarKid\bin\x86\Debug\Content\LifeLost.xnb 
     20C:\MyTemp\AarniAR\AdventureOfStarKid\AdventureOfStarKid\AdventureOfStarKid\bin\x86\Debug\Content\Damage.xnb 
  • 2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid/obj/x86/Debug/ContentPipeline-{ECF942E0-B21C-45ED-8977-79F4B42A7C44}.xml

    r5617 r5625  
    3636      <Options>None</Options> 
    3737      <Output>C:\MyTemp\AarniAR\AdventureOfStarKid\AdventureOfStarKid\AdventureOfStarKid\bin\x86\Debug\Content\kentta1.xnb</Output> 
    38       <Time>2014-07-23T13:05:58.0977535+03:00</Time> 
     38      <Time>2014-07-24T11:08:51.8602288+03:00</Time> 
    3939    </Item> 
    4040    <Item> 
     
    101101      <Time>2014-07-24T10:36:40.4322288+03:00</Time> 
    102102    </Item> 
     103    <Item> 
     104      <Source>Damage.png</Source> 
     105      <Name>Damage</Name> 
     106      <Importer>TextureImporter</Importer> 
     107      <Processor>TextureProcessor</Processor> 
     108      <Options>None</Options> 
     109      <Output>C:\MyTemp\AarniAR\AdventureOfStarKid\AdventureOfStarKid\AdventureOfStarKid\bin\x86\Debug\Content\Damage.xnb</Output> 
     110      <Time>2014-07-24T10:59:27.3624288+03:00</Time> 
     111    </Item> 
    103112    <BuildSuccessful>true</BuildSuccessful> 
    104113    <Settings> 
  • 2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKid/obj/x86/Debug/cachefile-{ECF942E0-B21C-45ED-8977-79F4B42A7C44}-targetpath.txt

    r5617 r5625  
    1010Content\jumpinganimation.xnb 
    1111Content\LifeLost.xnb 
     12Content\Damage.xnb 
  • 2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKidContent/AdventureOfStarKidContent.contentproj

    r5617 r5625  
    116116    </Compile> 
    117117  </ItemGroup> 
     118  <ItemGroup> 
     119    <Compile Include="Damage.png"> 
     120      <Name>Damage</Name> 
     121      <Importer>TextureImporter</Importer> 
     122      <Processor>TextureProcessor</Processor> 
     123    </Compile> 
     124  </ItemGroup> 
    118125  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    119126  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2014/30/AarniAR/AdventureOfStarKid/AdventureOfStarKid/AdventureOfStarKidContent/kentta1.txt

    r5584 r5625  
    1          *           * 
    2          ##             ##  ## 
     1         *      * 
     2         ##     ##  ## 
    33 
    44       *    * 
Note: See TracChangeset for help on using the changeset viewer.