Changeset 6691


Ignore:
Timestamp:
2015-07-01 15:01:31 (8 years ago)
Author:
pimaeeru
Message:
 
Location:
2015/27/PietuR
Files:
54 added
27 edited

Legend:

Unmodified
Added
Removed
  • 2015/27/PietuR/SoHaG/SoHaG/SoHaG/SoHaG.cs

    r6604 r6691  
    99public class SoHaG : PhysicsGame 
    1010{ 
     11    //Korjaa sirut 
     12    //TODO Lisää avain 
     13    //TODO Lisää valikko 
     14    //TODO Lisää kenttiä 
     15 
    1116    int Kenttia = 3; 
     17 
    1218 
    1319    Image SeinanKuva = LoadImage("Seina1"); 
     
    2127    Image LattianKuva = LoadImage("Lattia"); 
    2228    Image LaatanKuva = LoadImage("Lattialaatta"); 
     29    Image Vihun1Kuva = LoadImage("Greed"); 
     30    Image Vihun2Kuva = LoadImage("Hope"); 
     31    Image Sirunkuva = LoadImage("Shard"); 
     32    Image TaskuvalonKuva = LoadImage("Taskulampunvalo"); 
     33    SoundEffect Reversed = LoadSoundEffect("Reversed"); 
     34    SoundEffect Sinister = LoadSoundEffect("Sinister"); 
     35    SoundEffect Button = LoadSoundEffect("Button"); 
     36    SoundEffect GhostKid = LoadSoundEffect("Ghost Kid"); 
     37    SoundEffect Scream = LoadSoundEffect("Scream"); 
     38     
    2339 
    2440    PhysicsObject Tyyppi1; 
     
    2945    List<Vector> Spawnit = new List<Vector>(); 
    3046    List<Vector> VihuSpawnit = new List<Vector>(); 
     47    List<Vector> SiruSpawnit = new List<Vector>(); 
     48 
     49    List<SoundEffect> soitettu = new List<SoundEffect>(); 
    3150 
    3251    public override void Begin() 
     
    3958        Tyyppi4 = Luotyyppi(Tyypin4Kuva); 
    4059 
    41         LuoVihu(); 
    42         LuoVihu(); 
    43         LuoVihu(); 
    44  
    45         Timer näkyvyysAjastin = new Timer(); 
    46         näkyvyysAjastin.Interval = 0.05; 
    47         näkyvyysAjastin.Timeout += delegate 
    48         { 
    49             Tarkistanakyvyys(Tyyppi1); 
    50             Tarkistanakyvyys(Tyyppi2); 
    51             Tarkistanakyvyys(Tyyppi3); 
    52             Tarkistanakyvyys(Tyyppi4); 
    53         }; 
    54         näkyvyysAjastin.Start(); 
     60        Camera.Follow(Tyyppi1, Tyyppi2, Tyyppi3, Tyyppi4); 
     61 
     62        LuoShadow(); 
     63        LuoShadow(); 
     64        LuoShadow(); 
     65        LuoHope(); 
     66 
     67        MediaPlayer.Play(RandomGen.SelectOne("Day of Chaos", "Echoes of Time", "Evening of Chaos", "Night of Chaos", "Penumbra")); 
     68        GhostKid.Play(); 
     69 
     70 
     71        //Timer näkyvyysAjastin = new Timer(); 
     72        //näkyvyysAjastin.Interval = 0.05; 
     73        //näkyvyysAjastin.Timeout += delegate 
     74        //{ 
     75        //    Tarkistanakyvyys(Tyyppi1); 
     76        //    Tarkistanakyvyys(Tyyppi2); 
     77        //    Tarkistanakyvyys(Tyyppi3); 
     78        //    Tarkistanakyvyys(Tyyppi4); 
     79        //}; 
     80        //näkyvyysAjastin.Start(); 
    5581 
    5682        Keyboard.Listen(Key.Up, ButtonState.Down, Liikuta, "Liikuttaa pelaajaa1", Tyyppi1, Direction.Up); 
     
    80106    { 
    81107        Tyyppi.Push(Suunta.GetVector()*3000); 
    82         Tyyppi.Angle = Tyyppi.Velocity.Angle+Angle.FromDegrees(90); 
     108        Tyyppi.Angle = Tyyppi.Velocity.Angle; 
    83109    } 
    84110 
     
    93119        Ruudut.SetTileMethod(Color.FromHexCode("7F0000"), LuoSeina2); 
    94120        Ruudut.SetTileMethod(Color.FromHexCode("FF6A00"), LuoNappula); 
     121        Ruudut.SetTileMethod(Color.FromHexCode("00FFFF"), LuoSirunpaikka); 
    95122        Ruudut.SetTileMethod(Color.Red, LuoVihunpaikka); 
    96123        Ruudut.Execute(20, 20); 
     
    103130        Pimeys.Color = new Color(0, 0, 0, 210); 
    104131        Add(Pimeys, 2); 
     132 
    105133    } 
    106134 
     
    110138        Seina.Position = Paikka; 
    111139        Seina.Image = SeinanKuva; 
     140        Seina.CollisionIgnoreGroup = 1; 
    112141        Add(Seina); 
    113142    } 
     
    117146        Seina2.Position = Paikka; 
    118147        Seina2.Image = Seinan2Kuva; 
     148        Seina2.CollisionIgnoreGroup = 1; 
    119149        Add(Seina2); 
    120150    } 
    121     void LuoVihu() 
    122     { 
    123         PhysicsObject Vihu = new PhysicsObject(319 * 0.1, 218 * 0.1); 
     151    void LuoSiru() 
     152    { 
     153        PhysicsObject Siru = new PhysicsObject(20, 20); 
     154        Siru.Image = Sirunkuva; 
     155        Siru.Shape = Shape.Circle; 
     156        Add(Siru); 
     157 
     158        AddCollisionHandler(Siru, "Tyyppi", delegate(PhysicsObject N, PhysicsObject T) 
     159        { 
     160            Siru.Destroy(); 
     161        }); 
     162 
     163    } 
     164 
     165    void LuoVihu(Image kuva, double speed, bool liikkuuPimeassa, SoundEffect aani) 
     166    { 
     167        PhysicsObject Vihu = new PhysicsObject(218 * 0.21, 319 * 0.1); 
    124168        Vihu.LinearDamping = 0.5; 
    125169        Vihu.AngularDamping = 0.7; 
    126         Vihu.Image = Tyypin4Kuva; 
     170        Vihu.Image = kuva; 
    127171        Vihu.Shape = Shape.Circle; 
    128172        Vector Paikka = RandomGen.SelectOne<Vector>(VihuSpawnit); 
     
    130174        Vihu.Position = Paikka; 
    131175        Vihu.Tag = "Vihu"; 
     176        Vihu.CollisionIgnoreGroup = 1; 
     177 
     178        RandomMoverBrain satunnaisAivot = new RandomMoverBrain(speed); 
     179        satunnaisAivot.TurnWhileMoving = true; 
     180 
     181        FollowerBrain seuraajanAivot = new FollowerBrain(Tyyppi1, Tyyppi2, Tyyppi3, Tyyppi4); 
     182        seuraajanAivot.Speed = speed; 
     183        seuraajanAivot.TurnWhileMoving = true; 
     184        seuraajanAivot.DistanceFar = 600; 
     185        seuraajanAivot.FarBrain = satunnaisAivot; 
     186 
     187        Vihu.Brain = seuraajanAivot; 
     188 
     189        Timer päivitysAjastin = new Timer(); 
     190        päivitysAjastin.Interval = 0.05; 
     191        päivitysAjastin.Timeout += delegate 
     192        { 
     193            Tarkistanakyvyys(Vihu); 
     194 
     195            if (liikkuuPimeassa) 
     196            { 
     197                if (Vihu.IsVisible) 
     198                { 
     199                    Vihu.Brain = null; 
     200                    SoitaAani(aani); 
     201                } 
     202                else 
     203                { 
     204                    Vihu.Brain = seuraajanAivot; 
     205                } 
     206            } 
     207            else 
     208            { 
     209                if (Vihu.IsVisible) 
     210                { 
     211                    Vihu.Brain = seuraajanAivot; 
     212                    SoitaAani(aani); 
     213                } 
     214                else 
     215                { 
     216                    Vihu.Brain = null; 
     217                } 
     218            } 
     219        }; 
     220        päivitysAjastin.Start(); 
     221 
    132222        Add(Vihu); 
     223    } 
     224 
     225    void SoitaAani(SoundEffect aani) 
     226    { 
     227        if (!soitettu.Contains(aani)) 
     228        { 
     229            soitettu.Add(aani); 
     230            aani.Play(); 
     231            Timer.SingleShot(4, delegate { soitettu.Remove(aani); }); 
     232        } 
     233    } 
     234 
     235    void LuoShadow() 
     236    { 
     237        LuoVihu(Vihun1Kuva, 100, true, Sinister); 
     238    } 
     239    void LuoHope() 
     240    { 
     241        LuoVihu(Vihun2Kuva, 500, false, Reversed); 
    133242    } 
    134243    void LuoNappula(Vector Paikka, double leveys, double korkeus) 
     
    137246        Nappula.Position = Paikka; 
    138247        Nappula.Image = NappulanKuva; 
     248        Nappula.CollisionIgnoreGroup = 1; 
    139249        Add(Nappula); 
    140250 
    141         DoubleMeter Energia = new DoubleMeter(100, 0, 100); 
     251        DoubleMeter Energia = new DoubleMeter(1, 0, 100); 
    142252        ProgressBar Energiapalkki = new ProgressBar(20, 5); 
    143253        Energiapalkki.Y = 20; 
     
    162272        { 
    163273            Energia.Value = Energia.MaxValue; 
     274            Button.Play(); 
    164275            Valo.IsVisible = true; 
    165276        }); 
     277 
     278 
    166279    } 
    167280    PhysicsObject Luotyyppi(Image Kuva) 
    168281    { 
    169         PhysicsObject Tyyppi = new PhysicsObject(319 * 0.1, 218 * 0.1); 
     282        PhysicsObject Tyyppi = new PhysicsObject(218 * 0.1, 319 * 0.1); 
    170283        Tyyppi.LinearDamping = 0.5; 
    171284        Tyyppi.AngularDamping = 0.7; 
     
    176289        Tyyppi.Position = Paikka; 
    177290        Tyyppi.Tag = "Tyyppi"; 
    178         Add(Tyyppi); 
     291        Add(Tyyppi, 3); 
     292 
     293        GameObject Valo = new GameObject(300, 300); 
     294        //Valo.Position = Paikka; 
     295        Valo.Tag = "valo"; 
     296        Valo.Image = TaskuvalonKuva; 
     297        Valo.X = 25; 
     298        Valo.Y = 5; 
     299        Tyyppi.Add(Valo); 
     300 
     301        AddCollisionHandler(Tyyppi, "Vihu", delegate(PhysicsObject N, PhysicsObject T) 
     302        { 
     303            Tyyppi.Destroy(); 
     304            Scream.Play(); 
     305        }); 
    179306 
    180307        return Tyyppi; 
     
    184311        Spawnit.Add(Paikka); 
    185312    } 
     313 
     314    void LuoSirunpaikka(Vector Paikka, double leveys, double korkeus) 
     315    { 
     316        SiruSpawnit.Add(Paikka); 
     317    } 
     318 
    186319    void LuoVihunpaikka(Vector Paikka, double leveys, double korkeus) 
    187320    { 
    188321        VihuSpawnit.Add(Paikka); 
     322        VihuSpawnit.Add(Paikka); 
    189323    } 
    190324 
     
    192326    { 
    193327        bool piilossa = true; 
     328 
     329        // Kentässä olevat valot. 
    194330        foreach (var valo in GetObjectsWithTag("valo")) 
    195331        { 
     
    201337        } 
    202338 
     339        PhysicsObject[] pelaajat = { Tyyppi1, Tyyppi2, Tyyppi3, Tyyppi4 }; 
     340        double lampunPituus = 300 * 0.5; 
     341        double lampunKulma = 45; 
     342 
     343        // Pelaajan taskulamppu. 
     344        foreach (var pelaaja in pelaajat) 
     345        { 
     346            if (pelaaja.IsDestroyed) 
     347                continue; 
     348 
     349            Angle kulma = (Olio.Position - pelaaja.Position).Angle; 
     350            if (Math.Abs(kulma.Degrees - pelaaja.Angle.Degrees) < lampunKulma && Vector.Distance(pelaaja.Position, Olio.Position) < lampunPituus) 
     351            { 
     352                piilossa = false; 
     353            } 
     354        } 
     355 
    203356        Olio.IsVisible = !piilossa; 
    204357    } 
  • 2015/27/PietuR/SoHaG/SoHaG/SoHaG/SoHaG.csproj.Debug.cachefile

    r6604 r6691  
     1Content\KenttÀ1.xnb 
     2Content\Seina1.xnb 
    13Content\Tyyppi1.xnb 
    24Content\Tyyppi1KÀvely1.xnb 
     
    1113Content\Tyyppi4KÀvely1.xnb 
    1214Content\Tyyppi4KÀvely2.xnb 
    13 Content\KenttÀ1.xnb 
    14 Content\Seina1.xnb 
    1515Content\Nappula.xnb 
    1616Content\Seina2.xnb 
     
    2020Content\Lattia.xnb 
    2121Content\Lattialaatta.xnb 
     22Content\Greed.xnb 
     23Content\Hope.xnb 
     24Content\Taskulampunvalo.xnb 
     25Content\Day of Chaos.xnb 
     26Content\Echoes of Time.xnb 
     27Content\Evening of Chaos.xnb 
     28Content\Night of Chaos.xnb 
     29Content\Penumbra.xnb 
     30Content\Remmende_auto.xnb 
     31Content\Reversed.xnb 
     32Content\Sinister.xnb 
     33Content\Ghost Kid.xnb 
     34Content\What Child is this.xnb 
     35Content\Fucked up.xnb 
     36Content\Scream.xnb 
     37Content\Button.xnb 
     38Content\Shard.xnb 
     39Content\Day of Chaos.wma 
     40Content\Echoes of Time.wma 
     41Content\Evening of Chaos.wma 
     42Content\Night of Chaos.wma 
     43Content\Penumbra.wma 
     44Content\What Child is this.wma 
  • 2015/27/PietuR/SoHaG/SoHaG/SoHaG/obj/x86/Debug/SoHaG.csproj.FileListAbsolute.txt

    r6604 r6691  
    2828C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Lattia.xnb 
    2929C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Lattialaatta.xnb 
     30C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Greed.xnb 
     31C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Hope.xnb 
     32C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Taskulampunvalo.xnb 
     33C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Day of Chaos.xnb 
     34C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Echoes of Time.xnb 
     35C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Evening of Chaos.xnb 
     36C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Night of Chaos.xnb 
     37C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Penumbra.xnb 
     38C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Day of Chaos.wma 
     39C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Echoes of Time.wma 
     40C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Evening of Chaos.wma 
     41C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Night of Chaos.wma 
     42C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Penumbra.wma 
     43C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Remmende_auto.xnb 
     44C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Reversed.xnb 
     45C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Sinister.xnb 
     46C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Ghost Kid.xnb 
     47C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\What Child is this.xnb 
     48C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\What Child is this.wma 
     49C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Fucked up.xnb 
     50C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Scream.xnb 
     51C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Button.xnb 
     52C:\MyTemp\PietuR\SoHaG\SoHaG\SoHaG\bin\x86\Debug\Content\Shard.xnb 
  • 2015/27/PietuR/SoHaG/SoHaG/SoHaG/obj/x86/Debug/cachefile-{4BEC25C0-5414-4199-9B12-AD80EDADF21A}-targetpath.txt

    r6604 r6691  
     1Content\KenttÀ1.xnb 
     2Content\Seina1.xnb 
    13Content\Tyyppi1.xnb 
    24Content\Tyyppi1KÀvely1.xnb 
     
    1113Content\Tyyppi4KÀvely1.xnb 
    1214Content\Tyyppi4KÀvely2.xnb 
    13 Content\KenttÀ1.xnb 
    14 Content\Seina1.xnb 
    1515Content\Nappula.xnb 
    1616Content\Seina2.xnb 
     
    2020Content\Lattia.xnb 
    2121Content\Lattialaatta.xnb 
     22Content\Greed.xnb 
     23Content\Hope.xnb 
     24Content\Taskulampunvalo.xnb 
     25Content\Day of Chaos.xnb 
     26Content\Day of Chaos.wma 
     27Content\Echoes of Time.xnb 
     28Content\Echoes of Time.wma 
     29Content\Evening of Chaos.xnb 
     30Content\Evening of Chaos.wma 
     31Content\Night of Chaos.xnb 
     32Content\Night of Chaos.wma 
     33Content\Penumbra.xnb 
     34Content\Penumbra.wma 
     35Content\Remmende_auto.xnb 
     36Content\Reversed.xnb 
     37Content\Sinister.xnb 
     38Content\Ghost Kid.xnb 
     39Content\What Child is this.xnb 
     40Content\What Child is this.wma 
     41Content\Fucked up.xnb 
     42Content\Scream.xnb 
     43Content\Button.xnb 
     44Content\Shard.xnb 
  • 2015/27/PietuR/SoHaG/SoHaG/SoHaGContent/SoHaGContent.contentproj

    r6604 r6691  
    168168    </Compile> 
    169169  </ItemGroup> 
     170  <ItemGroup> 
     171    <Compile Include="Greed.png"> 
     172      <Name>Greed</Name> 
     173      <Importer>TextureImporter</Importer> 
     174      <Processor>TextureProcessor</Processor> 
     175    </Compile> 
     176    <Compile Include="Hope.png"> 
     177      <Name>Hope</Name> 
     178      <Importer>TextureImporter</Importer> 
     179      <Processor>TextureProcessor</Processor> 
     180    </Compile> 
     181  </ItemGroup> 
     182  <ItemGroup> 
     183    <Compile Include="Taskulampunvalo.png"> 
     184      <Name>Taskulampunvalo</Name> 
     185      <Importer>TextureImporter</Importer> 
     186      <Processor>TextureProcessor</Processor> 
     187    </Compile> 
     188  </ItemGroup> 
     189  <ItemGroup> 
     190    <Compile Include="Day of Chaos.mp3"> 
     191      <Name>Day of Chaos</Name> 
     192      <Importer>Mp3Importer</Importer> 
     193      <Processor>SongProcessor</Processor> 
     194    </Compile> 
     195    <Compile Include="Echoes of Time.mp3"> 
     196      <Name>Echoes of Time</Name> 
     197      <Importer>Mp3Importer</Importer> 
     198      <Processor>SongProcessor</Processor> 
     199    </Compile> 
     200    <Compile Include="Evening of Chaos.mp3"> 
     201      <Name>Evening of Chaos</Name> 
     202      <Importer>Mp3Importer</Importer> 
     203      <Processor>SongProcessor</Processor> 
     204    </Compile> 
     205    <Compile Include="Night of Chaos.mp3"> 
     206      <Name>Night of Chaos</Name> 
     207      <Importer>Mp3Importer</Importer> 
     208      <Processor>SongProcessor</Processor> 
     209    </Compile> 
     210    <Compile Include="Penumbra.mp3"> 
     211      <Name>Penumbra</Name> 
     212      <Importer>Mp3Importer</Importer> 
     213      <Processor>SongProcessor</Processor> 
     214    </Compile> 
     215  </ItemGroup> 
     216  <ItemGroup> 
     217    <Compile Include="Remmende_auto.wav"> 
     218      <Name>Remmende_auto</Name> 
     219      <Importer>WavImporter</Importer> 
     220      <Processor>SoundEffectProcessor</Processor> 
     221    </Compile> 
     222    <Compile Include="Reversed.wav"> 
     223      <Name>Reversed</Name> 
     224      <Importer>WavImporter</Importer> 
     225      <Processor>SoundEffectProcessor</Processor> 
     226    </Compile> 
     227    <Compile Include="Sinister.wav"> 
     228      <Name>Sinister</Name> 
     229      <Importer>WavImporter</Importer> 
     230      <Processor>SoundEffectProcessor</Processor> 
     231    </Compile> 
     232  </ItemGroup> 
     233  <ItemGroup> 
     234    <Compile Include="Ghost Kid.wav"> 
     235      <Name>Ghost Kid</Name> 
     236      <Importer>WavImporter</Importer> 
     237      <Processor>SoundEffectProcessor</Processor> 
     238    </Compile> 
     239  </ItemGroup> 
     240  <ItemGroup> 
     241    <Compile Include="What Child is this.mp3"> 
     242      <Name>What Child is this</Name> 
     243      <Importer>Mp3Importer</Importer> 
     244      <Processor>SongProcessor</Processor> 
     245    </Compile> 
     246  </ItemGroup> 
     247  <ItemGroup> 
     248    <Compile Include="Fucked up.wav"> 
     249      <Name>Fucked up</Name> 
     250      <Importer>WavImporter</Importer> 
     251      <Processor>SoundEffectProcessor</Processor> 
     252    </Compile> 
     253  </ItemGroup> 
     254  <ItemGroup> 
     255    <Compile Include="Scream.wav"> 
     256      <Name>Scream</Name> 
     257      <Importer>WavImporter</Importer> 
     258      <Processor>SoundEffectProcessor</Processor> 
     259    </Compile> 
     260  </ItemGroup> 
     261  <ItemGroup> 
     262    <Compile Include="Button.wav"> 
     263      <Name>Button</Name> 
     264      <Importer>WavImporter</Importer> 
     265      <Processor>SoundEffectProcessor</Processor> 
     266    </Compile> 
     267  </ItemGroup> 
     268  <ItemGroup> 
     269    <Compile Include="Shard.png"> 
     270      <Name>Shard</Name> 
     271      <Importer>TextureImporter</Importer> 
     272      <Processor>TextureProcessor</Processor> 
     273    </Compile> 
     274  </ItemGroup> 
    170275  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    171276  <!--  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.