Changeset 955 for 2010/23


Ignore:
Timestamp:
2010-06-17 15:59:38 (13 years ago)
Author:
hniemi
Message:

Vihollisalus lisätty, Hudia paranneltu

Location:
2010/23/hniemi/ShootEmUp
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • 2010/23/hniemi/ShootEmUp/ShootEmUp/Alus.cs

    r932 r955  
    6464        public void SetWeapon(Weapon ase)  
    6565        { 
    66             kaytossaOlevaAse.IsVisible = false; 
    67             ase.IsVisible = true; 
    6866            kaytossaOlevaAse = ase; 
    69  
    7067        } 
    7168 
     
    7875            if ( panos != null) {  
    7976                panos.Angle = this.Angle; 
    80             }  
    81              
     77            }     
    8278        } 
    8379 
    84         public void TimerShoot(Timer sender) 
     80        /// <summary> 
     81        /// Ampuu silloin kun kutsutaan, timer-kutsuja varten 
     82        /// </summary> 
     83        /// <param name="sender">Ei käytössä</param> 
     84        public void Shoot(Timer sender) 
    8585        { 
    86             PhysicsObject panos = kaytossaOlevaAse.Shoot(); 
    87             if (panos != null) 
    88             { 
    89                 panos.Angle = this.Angle; 
    90                  
    91             } 
     86            this.Shoot(); 
     87            //PhysicsObject panos = kaytossaOlevaAse.Shoot(); 
     88            //if (panos != null) 
     89            //{ 
     90            //    panos.Angle = this.Angle; 
     91            //} 
    9292        } 
    9393 
  • 2010/23/hniemi/ShootEmUp/ShootEmUp/Content/Content.contentproj

    r922 r955  
    117117    </Compile> 
    118118  </ItemGroup> 
     119  <ItemGroup> 
     120    <Compile Include="seina\seinaOikea.png"> 
     121      <Name>seinaOikea</Name> 
     122      <Importer>TextureImporter</Importer> 
     123      <Processor>TextureProcessor</Processor> 
     124    </Compile> 
     125  </ItemGroup> 
     126  <ItemGroup> 
     127    <Compile Include="seina\seinaKulma.png"> 
     128      <Name>seinaKulma</Name> 
     129      <Importer>TextureImporter</Importer> 
     130      <Processor>TextureProcessor</Processor> 
     131    </Compile> 
     132  </ItemGroup> 
     133  <ItemGroup> 
     134    <Compile Include="vihollinen4.png"> 
     135      <Name>vihollinen4</Name> 
     136      <Importer>TextureImporter</Importer> 
     137      <Processor>TextureProcessor</Processor> 
     138    </Compile> 
     139  </ItemGroup> 
    119140  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    120141  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  
  • 2010/23/hniemi/ShootEmUp/ShootEmUp/Content/obj/x86/Debug/ContentPipeline.xml

    r922 r955  
    119119      <Time>2010-06-16T15:40:02.4717759+03:00</Time> 
    120120    </Item> 
     121    <Item> 
     122      <Source>seina\seinaOikea.png</Source> 
     123      <Name>seina\seinaOikea</Name> 
     124      <Importer>TextureImporter</Importer> 
     125      <Processor>TextureProcessor</Processor> 
     126      <Options>None</Options> 
     127      <Output>C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\seina\seinaOikea.xnb</Output> 
     128      <Time>2010-06-17T14:23:38.7333064+03:00</Time> 
     129    </Item> 
     130    <Item> 
     131      <Source>seina\seinaKulma.png</Source> 
     132      <Name>seina\seinaKulma</Name> 
     133      <Importer>TextureImporter</Importer> 
     134      <Processor>TextureProcessor</Processor> 
     135      <Options>None</Options> 
     136      <Output>C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\seina\seinaKulma.xnb</Output> 
     137      <Time>2010-06-17T14:22:40.0307488+03:00</Time> 
     138    </Item> 
     139    <Item> 
     140      <Source>vihollinen4.png</Source> 
     141      <Name>vihollinen4</Name> 
     142      <Importer>TextureImporter</Importer> 
     143      <Processor>TextureProcessor</Processor> 
     144      <Options>None</Options> 
     145      <Output>C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\vihollinen4.xnb</Output> 
     146      <Time>2010-06-17T15:56:12.7345408+03:00</Time> 
     147    </Item> 
    121148    <BuildSuccessful>true</BuildSuccessful> 
    122149    <Settings> 
  • 2010/23/hniemi/ShootEmUp/ShootEmUp/Peli.cs

    r944 r955  
    1515        //Liikkumisnopeudet 
    1616        private const double NOPEUS = 300; 
     17        private const int OLETUSASE = 0; 
    1718        private Vector nopeusPysty = new Vector(0,NOPEUS); 
    1819        private Vector nopeusVaaka = new Vector(NOPEUS, 0); 
     
    2627        private PhysicsObject exitZone; 
    2728 
     29        private GameObject[] tahdet; 
     30 
    2831        //Viholliset 
    29         private const int VIHOLLISKUVIA = 3; 
     32        private const int VIHOLLISKUVIA = 4; 
    3033 
    3134        //Statistiikka 
    3235        private int kentannro = 0; 
    3336        private IntMeter score = new IntMeter(0); 
     37        private IntMeter lives = new IntMeter(3); 
     38        private TextDisplay[] aseNimet; 
    3439        private Weapon[] weapons; 
    3540 
    3641        #endregion 
    3742 
     43        /// <summary> 
     44        /// Aloittaa pelin 
     45        /// </summary> 
    3846        protected override void Begin() 
    3947        { 
    4048            LataaKentta(kentannro); 
     49        } 
     50 
     51        /// <summary> 
     52        /// Päivityssilmukka, hoitaa tällä hetkellä manuaalisesti vain 
     53        /// taustan liikuttamisen 
     54        /// </summary> 
     55        /// <param name="time"></param> 
     56        protected override void Update(Time time) 
     57        { 
     58            if (tahdet != null) 
     59            { 
     60                for (int i = 0; i < tahdet.Length; i++) 
     61                { 
     62                    tahdet[i].Y -= 30; 
     63                    if (tahdet[i].Y < Level.Bottom - 40) tahdet[i].Y = Level.Top + 100; 
     64                } 
     65            } 
     66 
     67            base.Update(time); 
    4168        } 
    4269 
     
    5582 
    5683            Camera.Move(new Vector(250, 0)); 
    57  
     84            //Camera.Zoom(0.2); 
     85             
    5886            //Laidat 
    5987            LisaData tieto; 
     
    6189            tieto.Rajahtaa = true; 
    6290            tieto.Damage = 5; 
     91 
     92            PhysicsObject[] kulmat = new PhysicsObject[4]; 
     93 
     94            for (int i = 0; i < kulmat.Length; i++) 
     95            { 
     96                kulmat[i] = PhysicsObject.CreateStaticObject(60, 60); 
     97                kulmat[i].Image = LoadImage("seina/seinaKulma"); 
     98                kulmat[i].Tag = tieto; 
     99                kulmat[i].Angle = Angle.Degrees(i * 90); 
     100                Add(kulmat[i]); 
     101            } 
     102            kulmat[3].Position = new Vector(Level.Left - 30, Level.Top+30); 
     103            kulmat[2].Position = new Vector(Level.Right + 30, Level.Top + 30); 
     104            kulmat[0].Position = new Vector(Level.Left - 30, Level.Bottom - 30); 
     105            kulmat[1].Position = new Vector(Level.Right + 30, Level.Bottom - 30); 
     106 
     107 
     108            //Seinät 
     109            Level.BackgroundColor = Color.Black; 
    63110            vasenLaita = Level.CreateLeftBorder(); 
     111            vasenLaita.Image = LoadImage("seina/seinaOikea"); 
     112            vasenLaita.Angle = Angle.Degrees(270); 
     113 
    64114            vasenLaita.Tag = tieto; 
    65115            oikeaLaita = Level.CreateRightBorder(); 
     116            oikeaLaita.Image = LoadImage("seina/seinaOikea"); 
     117            oikeaLaita.Angle = Angle.Degrees(90); 
     118 
    66119            oikeaLaita.Tag = tieto; 
    67120            pohja = Level.CreateBottomBorder(); 
     121            pohja.Image = LoadImage("seina/seinaOikea"); 
     122            pohja.Angle = Angle.Degrees(0); 
     123            pohja.Size = new Vector(pohja.Width - 120, pohja.Height); 
     124 
    68125            pohja.Tag = tieto; 
    69126            katto = Level.CreateTopBorder(); 
     127            katto.Image = LoadImage("seina/seinaOikea"); 
     128            katto.Angle = Angle.Degrees(180); 
     129            katto.Size = new Vector(katto.Width - 120, katto.Height); 
     130 
    70131            katto.Tag = tieto; 
    71132 
     
    74135            exitZone.Position = new Vector(Level.Center.X, Level.Bottom - exitZone.Size.Y / 2 - 5); 
    75136            exitZone.Tag = tieto; 
     137            exitZone.IsVisible = false; 
    76138            Add(exitZone); 
    77139 
     140             
    78141            LuoPelaaja(); 
     142            LataaHUD(); 
    79143            LataaKontrollit(pelaajaAlus); 
    80             //LataaTausta(kentanNumero); 
     144            LataaTausta(kentanNumero); 
    81145            LataaViholliset(20, 4,10); 
    82             LataaHUD(); 
     146             
    83147        } 
    84148 
     
    88152        void LataaHUD() 
    89153        { 
    90             ValueDisplay hpNaytto = new ValueDisplay(); 
    91             hpNaytto.BindTo(pelaajaAlus.HpMeter); 
    92             Add(hpNaytto); 
    93             hpNaytto.Position = new Vector(Level.Right + 40, Level.Top - 80); 
    94             hpNaytto.Text = "HP: "; 
    95  
    96             ValueDisplay scoreNaytto = new ValueDisplay(); 
    97             scoreNaytto.BindTo(score); 
    98             Add(scoreNaytto); 
    99             scoreNaytto.Position = new Vector(Level.Right + 40, Level.Top - 100); 
    100             scoreNaytto.Text = "SCORE: "; 
    101  
     154            ValueDisplay[] naytot = new ValueDisplay[3]; 
     155            for (int i = 0; i < naytot.Length; i++) 
     156            { 
     157                naytot[i] = new ValueDisplay(); 
     158                Add(naytot[i]); 
     159                naytot[i].TextColor = Color.White; 
     160                naytot[i].ValueColor = Color.Yellow; 
     161                naytot[i].Position = new Vector(Level.Right + 40, Level.Top - 80 - (30*i)); 
     162            } 
     163 
     164            naytot[0].BindTo(pelaajaAlus.HpMeter); 
     165            naytot[1].BindTo(score); 
     166            naytot[2].BindTo(lives); 
     167            naytot[0].Text = "HP: "; 
     168            naytot[1].Text = "SCORE: "; 
     169            naytot[2].Text = "LIVES: "; 
     170 
     171            aseNimet = new TextDisplay[3]; 
     172            for (int i = 0; i < aseNimet.Length; i++) 
     173            { 
     174                aseNimet[i] = new TextDisplay(); 
     175                aseNimet[i].TextColor = Color.White; 
     176                aseNimet[i].Position = new Vector(Level.Right + 40, Level.Top - 200 - (30 * i)); 
     177                Add(aseNimet[i]); 
     178            } 
     179            aseNimet[OLETUSASE].TextColor = Color.Yellow; 
     180            aseNimet[0].Text = "Beam"; 
     181            aseNimet[1].Text = "Missile"; 
     182            aseNimet[2].Text = "Photon"; 
     183 
     184        } 
     185 
     186        /// <summary> 
     187        /// Lataa taustalle tähdet 
     188        /// </summary> 
     189        /// <param name="kentanNumero"></param> 
     190        void LataaTausta(int kentanNumero) 
     191        { 
     192            tahdet = new GameObject[15]; 
     193            for (int i = 0; i < tahdet.Length; i++) 
     194            { 
     195                GameObject tahti = new GameObject(3, 3); 
     196                tahti.Color = Color.White; 
     197                tahti.Position = new Vector(RandomGen.NextDouble(Level.Left, Level.Right), 
     198                                            RandomGen.NextDouble(Level.Top +20, Level.Top + 2000)); 
     199                tahdet[i] = tahti; 
     200 
     201                Add(tahti); 
     202            } 
    102203        } 
    103204 
     
    140241            for (int i = 0; i < weapons.Length; i++) 
    141242            { 
     243                weapons[i].IsVisible = false; 
    142244                pelaajaAlus.Add(weapons[i]); 
    143245            } 
    144246 
    145247            Add(pelaajaAlus); 
    146             pelaajaAlus.SetWeapon(weapons[2]); 
     248            pelaajaAlus.SetWeapon(weapons[OLETUSASE]); 
    147249             
    148250            AddCollisionHandler(pelaajaAlus, PelaajaTormaa); 
    149              
    150251        } 
    151252 
     
    193294        { 
    194295            if (aseenNumero > 0 && aseenNumero < 4) 
    195             pelaajaAlus.SetWeapon(weapons[aseenNumero-1]); 
     296            { 
     297                pelaajaAlus.SetWeapon(weapons[aseenNumero-1]); 
     298                for (int i = 0; i < aseNimet.Length; i++) 
     299                { 
     300                    aseNimet[i].TextColor = Color.White; 
     301                } 
     302                aseNimet[aseenNumero-1].TextColor = Color.Yellow; 
     303            } 
    196304        } 
    197305 
     
    262370            Timer ampumaAjastin = new Timer(); 
    263371            ampumaAjastin.Interval = 0.7; 
    264             ampumaAjastin.Trigger += alukset[0].TimerShoot; 
     372            ampumaAjastin.Trigger += alukset[0].Shoot; 
    265373            Add(ampumaAjastin); 
    266374            ampumaAjastin.Start(); 
  • 2010/23/hniemi/ShootEmUp/ShootEmUp/ShootEmUp.csproj.Debug.cachefile

    r922 r955  
    1212Content\loppuvastus1.xnb 
    1313Content\photon.xnb 
     14Content\seina\seinaOikea.xnb 
     15Content\seina\seinaKulma.xnb 
     16Content\vihollinen4.xnb 
  • 2010/23/hniemi/ShootEmUp/ShootEmUp/Weapons.cs

    r932 r955  
    3939            this.AddedToGame += LisaaAV; 
    4040            this.TimeBetweenUse = (new TimeSpan(0, 0, 0, 0, 5)); 
    41  
     41            this.IsVisible = false; 
    4242        } 
    4343 
     
    7373            projectile.IgnoresCollisionResponse = true; 
    7474            SetCollisionHandler(projectile, BeamCollision); 
    75             ShootProjectile(projectile, 3000); 
     75            ShootProjectile(projectile, 3000 + (Math.Sin(Game.Time.SinceStartOfGame.Milliseconds) * 100)); 
    7676 
    7777            return projectile; 
     
    9595            Level = 1; 
    9696            Damage = 20; 
     97            this.IsVisible = false; 
    9798            this.TimeBetweenUse = (new TimeSpan(0,0,0,0,300)); 
    9899            Color = Color.Blue; 
     
    160161            Color = Color.Blue; 
    161162            this.AddedToGame += LisaaAani; 
     163            this.IsVisible = false; 
    162164 
    163165            //Tagi 
  • 2010/23/hniemi/ShootEmUp/ShootEmUp/obj/x86/Debug/ShootEmUp.csproj.FileListAbsolute.txt

    r922 r955  
    3434C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\loppuvastus1.xnb 
    3535C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\photon.xnb 
     36C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\seina\seinaOikea.xnb 
     37C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\seina\seinaKulma.xnb 
     38C:\MyTemp\hniemi\ShootEmUp\ShootEmUp\bin\x86\Debug\Content\vihollinen4.xnb 
  • 2010/23/hniemi/ShootEmUp/ShootEmUp/obj/x86/Debug/cachefile-{72efbe00-2f1f-4e1d-9867-af4a5a7cd89e}-targetpath.txt

    r922 r955  
    1212Content\loppuvastus1.xnb 
    1313Content\photon.xnb 
     14Content\seina\seinaOikea.xnb 
     15Content\seina\seinaKulma.xnb 
     16Content\vihollinen4.xnb 
Note: See TracChangeset for help on using the changeset viewer.