Changeset 5158 for 2014/26


Ignore:
Timestamp:
2014-06-27 11:57:31 (5 years ago)
Author:
lajomart
Message:
 
Location:
2014/26/OttoW/Sticman The Last Stand
Files:
6 added
17 edited

Legend:

Unmodified
Added
Removed
  • 2014/26/OttoW/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last Stand/Pelaaja.cs

    r5131 r5158  
    2121    private Image potkuKuva = Sticman_The_Last_Stand.Peli.potkuKuva; 
    2222    private Image potkuKuvaPeilattu = Image.Mirror(Sticman_The_Last_Stand.Peli.potkuKuva); 
     23 
     24    private Image aseenkuva = Sticman_The_Last_Stand.Peli.aseenkuva; 
     25     
     26    double ammuksenElinika = 0.001; 
    2327 
    2428 
     
    4650    } 
    4751 
     52    public void Aseenkuva() 
     53    { 
     54        this.LyontiAse.Image = aseenkuva; 
     55        this.LyontiAse.IsVisible = true; 
     56        this.LyontiAse.Size = new Vector(50, 20); 
     57        this.LyontiAse.Position = new Vector(this.Position.X - 30.0, this.Position.Y + 400.0); 
     58        ammuksenElinika = 1.0; 
     59    } 
     60 
     61 
    4862    public void Lyo() 
    4963    { 
     
    5266        if (ammus == null) return; 
    5367 
    54         ammus.IsVisible = true; 
    55         ammus.MaximumLifetime = TimeSpan.FromSeconds(0.05); 
     68      //  ammus.IsVisible = false; 
     69        ammus.MaximumLifetime = TimeSpan.FromSeconds(ammuksenElinika); 
    5670 
    5771        Sticman_The_Last_Stand.Peli.AddCollisionHandler<PhysicsObject, PhysicsObject>(ammus, "taistelu", delegate(PhysicsObject a, PhysicsObject kohde) { HyokkaysOsui(a, kohde, 10); }); 
     
    7084            p.Elamat.Value -= damage; 
    7185            return; 
    72         } 
     86        }  
     87        else if (kohde.Tag.ToString() == "vihollinen") 
     88        { 
    7389        Vihollinen v = kohde as Vihollinen; 
    7490        v.Elamat.Value -= damage; 
     91        } 
    7592    } 
    7693 
     
    8198        if (ammus == null) return; 
    8299 
    83         ammus.IsVisible = true; 
     100        ammus.IsVisible = false; 
    84101        ammus.MaximumLifetime = TimeSpan.FromSeconds(0.05); 
    85102 
  • 2014/26/OttoW/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last Stand.csproj.Debug.cachefile

    r5131 r5158  
    1010Content\vihu velho.xnb 
    1111Content\part_of_-rainski-10200_hifi.xnb 
     12Content\haulikko.xnb 
     13Content\deagle.xnb 
     14Content\deagle2.xnb 
    1215Content\part_of_-rainski-10200_hifi.wma 
  • 2014/26/OttoW/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last Stand/Sticman_The_Last_Stand.cs

    r5131 r5158  
    2222    public Image[] kavelyAnimaatio = LoadImages("kavely anim", "kavely anim2"); 
    2323    Image taustaKuva; 
     24    public Image aseenkuva = LoadImage("deagle"); 
    2425 
    2526    public override void Begin() 
     
    4041        if (muoto == Pelimuoto.Yksinpeli) 
    4142        { 
    42             //LuoPelaaja(new Vector(Level.Left + 100, Level.Bottom + 100), 1); 
    4343            ruudut = ColorTileMap.FromLevelAsset("LAYOUT"); 
    4444            ruudut.SetTileMethod(Color.Black, LuoSeina); 
    4545            ruudut.SetTileMethod(Color.Azure, LuoTaso); 
    4646            ruudut.SetTileMethod(Color.Red, LuoPelaaja, 1, "yksinpeli"); 
    47             //ruudut.SetTileMethod(Color.BrightGreen, LuoPelaaja); 
    4847 
    4948            ruudut.Execute(); 
    5049            int vihuNumero = 0; 
    5150            LuoVihollinen(new Vector(RandomGen.NextDouble(Level.Right, Level.Right + 500), RandomGen.NextDouble(Level.Bottom, Level.Top)), vihuNumero); 
    52              
    5351        } 
    5452 
     
    115113        Gravity = new Vector(0.0, -1500.0); 
    116114        Level.Size = new Vector(Screen.Width, Screen.Height); 
    117         //Level.BackgroundColor = Color.Red; 
    118  
    119         /*  PhysicsObject alaReuna = Level.CreateBottomBorder(); 
    120           alaReuna.Tag = "lattia"; 
    121          *  
    122  
    123  
    124           PhysicsObject vasenReuna = Level.CreateLeftBorder(); 
    125           vasenReuna.IsVisible = false; 
    126           PhysicsObject oikeareuna = Level.CreateRightBorder(); 
    127           oikeareuna.IsVisible = false; 
    128           */ 
    129  
    130115    } 
    131116    void LuoSeina(Vector paikka, double leveys, double korkeus) 
     
    163148        p.Animation.FPS = 3; 
    164149        p.Animation.Start(); 
     150 
     151        if (p.Tag.ToString() == "coop") 
     152        { 
     153            p.Aseenkuva(); 
     154        } 
     155 
    165156        Add(p); 
    166157        Pelaajat[numero - 1] = p; 
    167158        AddCollisionHandler<PhysicsObject, PhysicsObject>(p, "lattia", delegate { p.IsOnGround = true; }); 
    168159        AddCollisionHandler<Pelaaja, Vihollinen>(p, delegate(Pelaaja pelaaja, Vihollinen v) { v.Elamat.Value -= 10; }); 
    169  
    170160        AddCollisionHandler(p, tormasi); 
    171161 
     
    187177    void LuoVihollinen(Vector paikka, int vihuNumero) 
    188178    { 
    189         Vihollinen vihu = new Vihollinen(150, 150, 10); 
    190         vihu.Position = new Vector(paikka.X + 200, paikka.Y); 
     179        Vihollinen vihu = new Vihollinen(150, 150, 100); 
     180        vihu.Position = paikka; 
    191181        vihu.Tag = "vihollinen"; 
    192182        vihu.Image = vihunKuva; 
    193183        vihu.Shape = Shape.FromImage(vihunKuva); 
    194184        vihu.CollisionIgnoreGroup = 1; 
     185        Viholliset[vihuNumero] = vihu; 
    195186        Add(vihu); 
    196187    } 
  • 2014/26/OttoW/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last Stand/Vihollinen.cs

    r5131 r5158  
    88public class Vihollinen : PhysicsObject 
    99{ 
     10    private LaserGun tulipallo { get; set; } 
    1011    public IntMeter Elamat { get; set; } 
    1112 
     
    1314        :base(width, height) 
    1415    { 
     16 
     17        FollowerBrain seuraajanAivot = new FollowerBrain(Sticman_The_Last_Stand.Peli.Pelaajat[0].Tag.ToString()); 
     18 
     19        seuraajanAivot.Speed = 100; 
     20        this.Brain = seuraajanAivot; 
     21        IgnoresGravity = true; 
     22        CanRotate = false; 
     23 
     24        this.tulipallo = new LaserGun(10, 5); 
     25        this.tulipallo.InfiniteAmmo = true; 
     26        this.tulipallo.CanHitOwner = false; 
     27        this.Add(tulipallo); 
     28 
    1529        this.Elamat = new IntMeter(elamat, 0, elamat); 
    1630        this.Elamat.LowerLimit += Destroy; 
    17         FollowerBrain seuraajanAivot = new FollowerBrain(Sticman_The_Last_Stand.Peli.Pelaajat[0]); 
    18         seuraajanAivot.Speed = 100; 
    19         this.Brain = seuraajanAivot; 
     31 
     32        Timer ajastin = new Timer(); 
     33        ajastin.Interval = 2; 
     34        ajastin.Timeout += Ammu; 
     35        ajastin.Start(); 
     36    } 
     37    public void Ammu() 
     38    { 
     39        Vector suunta = (Sticman_The_Last_Stand.Peli.Pelaajat[0].Position - this.Position).Normalize(); 
     40 
     41        this.tulipallo.Angle = suunta.Angle; 
     42        PhysicsObject laser = this.tulipallo.Shoot(); 
     43 
     44        if (laser == null) return; 
     45 
     46        laser.MaximumLifetime = TimeSpan.FromSeconds(0.5); 
     47 
     48        Sticman_The_Last_Stand.Peli.AddCollisionHandler<PhysicsObject, PhysicsObject>(laser, delegate(PhysicsObject a, PhysicsObject kohde) { VihuAmmusOsui(a, kohde, 10); }); 
     49    } 
     50    private void VihuAmmusOsui(PhysicsObject laser, PhysicsObject kohde, int damage) 
     51    { 
     52        laser.Destroy(); 
     53        if (kohde.Tag.Equals("coop") || kohde.Tag.Equals("yksinpeli")) 
     54        { 
     55            Pelaaja p = kohde as Pelaaja; 
     56            p.Elamat.Value -= damage; 
     57        } 
     58        return; 
    2059    } 
    2160} 
  • 2014/26/OttoW/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last Stand/obj/x86/Debug/ContentPipeline-{1C233C96-0670-4892-86F8-54BDFB238D36}.xml

    r5131 r5158  
    1818      <Options>None</Options> 
    1919      <Output>C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\pelaajan kuva.xnb</Output> 
    20       <Time>2014-06-26T10:14:42.9399202+03:00</Time> 
     20      <Time>2014-06-27T11:43:39.7367883+03:00</Time> 
    2121    </Item> 
    2222    <Item> 
     
    9090      <Options>None</Options> 
    9191      <Output>C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\vihu velho.xnb</Output> 
    92       <Time>2014-06-26T14:36:34.3835809+03:00</Time> 
     92      <Time>2014-06-27T11:21:52.9752312+03:00</Time> 
    9393    </Item> 
    9494    <Item> 
     
    101101      <Extra>C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\part_of_-rainski-10200_hifi.wma</Extra> 
    102102      <Time>2014-06-26T14:50:25.0987994+03:00</Time> 
     103    </Item> 
     104    <Item> 
     105      <Source>haulikko.jpg</Source> 
     106      <Name>haulikko</Name> 
     107      <Importer>TextureImporter</Importer> 
     108      <Processor>TextureProcessor</Processor> 
     109      <Options>None</Options> 
     110      <Output>C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\haulikko.xnb</Output> 
     111      <Time>2014-06-27T11:04:36+03:00</Time> 
     112    </Item> 
     113    <Item> 
     114      <Source>deagle.jpg</Source> 
     115      <Name>deagle</Name> 
     116      <Importer>TextureImporter</Importer> 
     117      <Processor>TextureProcessor</Processor> 
     118      <Options>None</Options> 
     119      <Output>C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\deagle.xnb</Output> 
     120      <Time>2014-06-27T11:35:14.4042376+03:00</Time> 
     121    </Item> 
     122    <Item> 
     123      <Source>deagle2.jpg</Source> 
     124      <Name>deagle2</Name> 
     125      <Importer>TextureImporter</Importer> 
     126      <Processor>TextureProcessor</Processor> 
     127      <Options>None</Options> 
     128      <Output>C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\deagle2.xnb</Output> 
     129      <Time>2014-06-27T11:35:49.2652671+03:00</Time> 
    103130    </Item> 
    104131    <BuildSuccessful>true</BuildSuccessful> 
  • 2014/26/OttoW/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last Stand/obj/x86/Debug/Sticman The Last Stand.csproj.FileListAbsolute.txt

    r5131 r5158  
    1919C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\part_of_-rainski-10200_hifi.xnb 
    2020C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\part_of_-rainski-10200_hifi.wma 
     21C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\haulikko.xnb 
     22C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\deagle.xnb 
     23C:\MyTemp\OttoW\Sticman The Last Stand\Sticman The Last Stand\Sticman The Last Stand\bin\x86\Debug\Content\deagle2.xnb 
  • 2014/26/OttoW/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last Stand/obj/x86/Debug/cachefile-{1C233C96-0670-4892-86F8-54BDFB238D36}-targetpath.txt

    r5131 r5158  
    1111Content\part_of_-rainski-10200_hifi.xnb 
    1212Content\part_of_-rainski-10200_hifi.wma 
     13Content\haulikko.xnb 
     14Content\deagle.xnb 
     15Content\deagle2.xnb 
  • 2014/26/OttoW/Sticman The Last Stand/Sticman The Last Stand/Sticman The Last StandContent/Sticman The Last StandContent.contentproj

    r5131 r5158  
    122122    </Compile> 
    123123  </ItemGroup> 
     124  <ItemGroup> 
     125    <Compile Include="haulikko.jpg"> 
     126      <Name>haulikko</Name> 
     127      <Importer>TextureImporter</Importer> 
     128      <Processor>TextureProcessor</Processor> 
     129    </Compile> 
     130  </ItemGroup> 
     131  <ItemGroup> 
     132    <Compile Include="deagle.jpg"> 
     133      <Name>deagle</Name> 
     134      <Importer>TextureImporter</Importer> 
     135      <Processor>TextureProcessor</Processor> 
     136    </Compile> 
     137  </ItemGroup> 
     138  <ItemGroup> 
     139    <Compile Include="deagle2.jpg"> 
     140      <Name>deagle2</Name> 
     141      <Importer>TextureImporter</Importer> 
     142      <Processor>TextureProcessor</Processor> 
     143    </Compile> 
     144  </ItemGroup> 
    124145  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    125146  <!--  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.