Changeset 1217 for 2010


Ignore:
Timestamp:
2010-07-09 12:21:46 (13 years ago)
Author:
vekakart
Message:

lisäsin jotakin

Location:
2010/27/Vekakart
Files:
7 added
3 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • 2010/27/Vekakart/Catch The Rainbow/Catch The Rainbow/Catch The Rainbow.csproj

    r1186 r1217  
    8989  </ItemGroup> 
    9090  <ItemGroup> 
    91     <Content Include="Crossword_hand.png"> 
    92       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> 
    93     </Content> 
    9491    <Content Include="Game.ico" /> 
    9592    <Content Include="GameThumbnail.png" /> 
  • 2010/27/Vekakart/Catch The Rainbow/Catch The Rainbow/Content/Content.contentproj

    r1186 r1217  
    4141    </Compile> 
    4242  </ItemGroup> 
     43  <ItemGroup> 
     44    <Compile Include="Crossword.png"> 
     45      <Name>Crossword</Name> 
     46      <Importer>TextureImporter</Importer> 
     47      <Processor>TextureProcessor</Processor> 
     48    </Compile> 
     49  </ItemGroup> 
     50  <ItemGroup> 
     51    <Compile Include="Knife1.png"> 
     52      <Name>Knife1</Name> 
     53      <Importer>TextureImporter</Importer> 
     54      <Processor>TextureProcessor</Processor> 
     55    </Compile> 
     56  </ItemGroup> 
     57  <ItemGroup> 
     58    <Compile Include="Max Mechanic D.png"> 
     59      <Name>Max Mechanic D</Name> 
     60      <Importer>TextureImporter</Importer> 
     61      <Processor>TextureProcessor</Processor> 
     62    </Compile> 
     63  </ItemGroup> 
    4364</Project> 
  • 2010/27/Vekakart/Catch The Rainbow/Catch The Rainbow/Peli.cs

    r1186 r1217  
    1313 
    1414    PhysicsObject Crossword; 
     15    PhysicsObject Chandler; 
    1516 
    1617    PlatformCharacter Max; 
     
    1819    protected override void Begin() 
    1920    { 
    20         LuoMax(); 
     21        ClearAll(); 
     22        //LuoMax(); 
    2123        AsetaOhjaimet(); 
    2224        LuoKentta(); 
     
    2527    void LuoKentta() 
    2628    { 
    27         Camera.FollowedObject = Max; 
     29         
    2830 
    2931        TileMap ruudut = TileMap.FromFile("Kentta 1.txt"); 
     
    3133        ruudut['C'] = LuoRainbow; 
    3234        ruudut['J'] = LuoCrossword; 
     35        ruudut['9'] = LuoChandler; 
     36        ruudut['1'] = LuoMax; 
    3337        ruudut.Insert(ruudunleveys, ruudunkorkeus); 
    3438 
    3539        Gravity = new Vector(0.0, -800.0); 
    36          
     40        Camera.FollowedObject = Max; 
    3741    } 
    3842    PhysicsObject LuoPalikka() 
     
    4953    } 
    5054 
    51     void LuoMax() 
     55   PhysicsObject LuoMax() 
    5256    { 
    5357        Max = new PlatformCharacter(35,45); 
    5458        Max.Restitution = 0.0; 
    5559        Max.CanRotate = false; 
    56         Max.X = -450; 
    57         Max.Y = -365; 
    5860        Max.Image = Image.FromFile("Max Mechanic.png"); 
    5961        Max.KineticFriction = 0.0; 
    60         Add (Max); 
    61         return; 
     62        Max.Tag = "Max"; 
     63       // Add(Max); 
     64        return Max; 
    6265    } 
    6366 
     
    98101    { 
    99102        Crossword = new PhysicsObject(35.0, 45.0); 
    100         Crossword.Image = Image.FromFile("Crossword_hand.png"); 
     103        Crossword.Image = Image.FromFile("Crossword.png"); 
    101104 
    102105        Timer ajastin = new Timer(); 
    103106        ajastin.Tag = Crossword; 
    104         ajastin.Interval = 1; 
     107        ajastin.Interval = 0.1; 
    105108        ajastin.Trigger += Tekoaly; 
    106109        Add (ajastin); 
     
    116119            etaisyys = etaisyys * -1; 
    117120        } 
    118         if (etaisyys < 150) 
     121        if (etaisyys < 200 && voiheittaa && vihollinen.Y > Max.Y) 
    119122        { 
    120             vihollinen.Image = LoadImage("Crossword2"); 
     123            if (vihollinen.X < Max.X) 
     124            { 
     125                vihollinen.Image = LoadImage("Crossword2"); 
     126                PhysicsObject Ase = LuoPuukko(); 
     127                Ase.Image = LoadImage("knife1"); 
     128                Ase.X = vihollinen.X+20; 
     129                Ase.Y = vihollinen.Y; 
     130                Ase.Hit(new Vector(500, 0)); 
     131                Add(Ase); 
     132                 
     133                 
     134            } 
     135            else 
     136            { 
     137                vihollinen.Image = LoadImage("Crossword"); 
     138                PhysicsObject Ase = LuoPuukko(); 
     139                Ase.Image = LoadImage("knife1"); 
     140                Ase.X = vihollinen.X-20; 
     141                Ase.Y = vihollinen.Y; 
     142                Ase.Hit(new Vector(-500, 0)); 
     143                Add(Ase); 
     144            } 
     145            voiheittaa = false; 
     146            Timer.SingleShot(1, saaheittaa); 
    121147        } 
    122148        sender.Start(); 
    123149    } 
     150    PhysicsObject LuoChandler() 
     151    { 
     152        Chandler = new PhysicsObject(20, 45); 
     153        //Chandler.Image = LoadImage ("Chandler1") 
     154        return Chandler; 
     155    } 
     156    PhysicsObject LuoPuukko() 
     157    { 
     158        PhysicsObject Puukko = new PhysicsObject(20.0, 5.0); 
     159        Puukko.MaximumLifetime = TimeSpan.FromSeconds(1); 
     160        AddCollisionHandler(Puukko, KasittelePuukonTormays); 
     161        Puukko.Tag = "p"; 
     162        return Puukko; 
     163    } 
    124164 
     165    void KasittelePuukonTormays(PhysicsObject puukko, PhysicsObject kohde) 
     166    { 
     167        if (kohde.Tag.ToString() == "Max") 
     168        { 
     169            Timer.SingleShot(1.5, Begin); 
     170            Max.Image = LoadImage("Max Mechanic D"); 
     171            ClearControls(); 
     172        } 
     173 
     174    } 
     175    bool voiheittaa = true; 
     176 
     177    void saaheittaa() 
     178    { 
     179        voiheittaa = true; 
     180    } 
    125181} 
Note: See TracChangeset for help on using the changeset viewer.