Changeset 5051


Ignore:
Timestamp:
2014-06-23 14:57:02 (9 years ago)
Author:
juiitamm
Message:
 
Location:
2013/26/OtsoR/Projekti
Files:
163 added
3 edited

Legend:

Unmodified
Added
Removed
  • 2013/26/OtsoR/Projekti/Projekti.sln

    r4203 r5051  
    44Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projekti", "Projekti\Projekti\Projekti.csproj", "{C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}" 
    55EndProject 
    6 Project("{96E2B04D-8817-42C6-938A-82C39BA4D311}") = "ProjektiContent", "Projekti\ProjektiContent\ProjektiContent.contentproj", "{97999162-0C3B-480A-AB91-BD553A4EB51F}" 
     6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjektiContent", "Projekti\ProjektiContent\ProjektiContent.contentproj", "{97999162-0C3B-480A-AB91-BD553A4EB51F}" 
     7EndProject 
     8Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jypeli", "..\Jypeli\Jypeli.csproj", "{74DD1DDD-283D-45D7-A79D-3DCB120708A6}" 
    79EndProject 
    810Global 
    911        GlobalSection(SolutionConfigurationPlatforms) = preSolution 
    1012                Debug|x86 = Debug|x86 
     13                DebugVisualize|x86 = DebugVisualize|x86 
    1114                Release|x86 = Release|x86 
    1215        EndGlobalSection 
     
    1417                {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.Debug|x86.ActiveCfg = Debug|x86 
    1518                {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.Debug|x86.Build.0 = Debug|x86 
     19                {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.DebugVisualize|x86.ActiveCfg = Debug|x86 
     20                {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.DebugVisualize|x86.Build.0 = Debug|x86 
    1621                {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.Release|x86.ActiveCfg = Release|x86 
    1722                {C1C3675E-0A8E-4516-9EE5-CB76E80DEC7B}.Release|x86.Build.0 = Release|x86 
    1823                {97999162-0C3B-480A-AB91-BD553A4EB51F}.Debug|x86.ActiveCfg = Debug|x86 
     24                {97999162-0C3B-480A-AB91-BD553A4EB51F}.DebugVisualize|x86.ActiveCfg = Debug|x86 
    1925                {97999162-0C3B-480A-AB91-BD553A4EB51F}.Release|x86.ActiveCfg = Release|x86 
     26                {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Debug|x86.ActiveCfg = Debug|x86 
     27                {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Debug|x86.Build.0 = Debug|x86 
     28                {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.DebugVisualize|x86.ActiveCfg = DebugVisualize|x86 
     29                {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.DebugVisualize|x86.Build.0 = DebugVisualize|x86 
     30                {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Release|x86.ActiveCfg = Release|x86 
     31                {74DD1DDD-283D-45D7-A79D-3DCB120708A6}.Release|x86.Build.0 = Release|x86 
    2032        EndGlobalSection 
    2133        GlobalSection(SolutionProperties) = preSolution 
  • 2013/26/OtsoR/Projekti/Projekti/Projekti/Projekti.cs

    r4310 r5051  
    103103            shipimages[i - 1] = LoadImage("s" + i); 
    104104        } 
     105 
    105106        IsMouseVisible = true; 
    106107        MultiSelectWindow numberofplayersmenu = new MultiSelectWindow("Select number of players", "1 Player", "2 Players", "Quit"); 
     
    108109        Add(numberofplayersmenu); 
    109110    } 
     111 
    110112    void mainmenu(int choice) 
    111113    { 
     
    193195        aluskuva.Image.ReplaceColor(Color.Black, shipcolors2[shipcolor1.Value]); 
    194196    } 
     197 
    195198    void Changeship2(int vanha, int uusi) 
    196199    { 
     
    267270        while (shipcounter < 39) 
    268271        { 
    269         int hostileship = RandomGen.NextInt(0, 100); 
    270         double hostiley = 0.0; 
    271         double hostilex = 0.0; 
    272         if (RandomGen.NextBool()) 
    273         { 
    274             hostiley = Level.Bottom + 2 * Level.Top * RandomGen.NextInt(0, 2); 
    275             hostilex = RandomGen.NextDouble(Level.Left, Level.Right); 
    276         } 
    277         else 
    278         { 
    279             hostiley = RandomGen.NextDouble(Level.Bottom, Level.Top); 
    280             hostilex = Level.Left + 2 * Level.Right * RandomGen.NextInt(0, 2); 
    281         } 
    282         Createhostile(hostileship, hostiley, hostilex); 
    283         shipcounter++; 
     272            int hostileship = RandomGen.NextInt(0, 100); 
     273            double hostiley = 0.0; 
     274            double hostilex = 0.0; 
     275            if (RandomGen.NextBool()) 
     276            { 
     277                hostiley = Level.Bottom + 2 * Level.Top * RandomGen.NextInt(0, 2); 
     278                hostilex = RandomGen.NextDouble(Level.Left, Level.Right); 
     279            } 
     280            else 
     281            { 
     282                hostiley = RandomGen.NextDouble(Level.Bottom, Level.Top); 
     283                hostilex = Level.Left + 2 * Level.Right * RandomGen.NextInt(0, 2); 
     284            } 
     285            Createhostile(hostileship, hostiley, hostilex); 
     286            shipcounter++; 
    284287        } 
    285288        while (bigshipcounter < 4) 
     
    420423        topedge.CollisionIgnoreGroup = 2; 
    421424    } 
     425 
    422426    void coop() 
    423427    { 
     
    451455        shipcolor2 = new IntMeter(0, 0, 3); 
    452456        shipcolor2.Changed += Changeship2; 
    453         shipcolour2.BindTo(shipcolor2);  
    454                  
     457        shipcolour2.BindTo(shipcolor2); 
     458 
    455459        shipimg2 = new IntMeter(1, 1, 100); 
    456460        shipimg2.Changed += Changeship2; 
     
    485489        shiptype.Y = 200; 
    486490        shiptype.BindTo(shipimg); 
    487          
     491 
    488492        Slider shipweapon = new Slider(125, 15); 
    489493        shipweapon.X = -225; 
     
    495499        shiptype2.Y = 200; 
    496500        shiptype2.BindTo(shipimg2); 
    497          
     501 
    498502        Slider shipweapon2 = new Slider(125, 15); 
    499503        shipweapon2.X = 425; 
     
    518522        Mouse.ListenOn(kohta2, MouseButton.Left, ButtonState.Pressed, coopbase, null); 
    519523    } 
     524 
    520525    void choice(int choice) 
    521526    { 
     
    586591        } 
    587592    } 
     593 
    588594    void fire(Weapon ase, Player ship) 
    589595    { 
     
    711717        Mouse.Listen(MouseButton.Left, ButtonState.Down, fire, null, weapon, ship1); 
    712718        Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, null); 
     719        Keyboard.Listen(Key.K, ButtonState.Pressed, delegate { MessageDisplay.Add(ship1.Position.ToString()); }, null); 
    713720    } 
    714721    void Aim(AnalogState hiirenLiike, Player ship) 
     
    743750        ship.Push(shipdirection); 
    744751    } 
     752 
    745753    void tilt(double direction, Player ship) 
    746754    { 
    747755        ship.AngularAcceleration = 10.0 * direction; 
    748756    } 
     757 
    749758    void singleplayerbase() 
    750759    { 
    751760        ClearAll(); 
     761        GameObject background = new GameObject(1500, 1500); 
    752762        Level.Background.CreateStars(); 
    753         Level.CreateBorders(); 
    754         Camera.ZoomToLevel(); 
     763        background.Image = Level.Background.Image; 
     764        background.Tag = "background"; 
     765        Add(background, -1); 
     766        Level.Background.Image = null; 
     767 
     768        Level.Size = new Vector(1500, 1500); 
     769        createedges(); 
    755770        Createship(0, 0); 
     771        Camera.Zoom(2); 
     772        Camera.Follow(ship1); 
     773        Camera.StayInLevel = true; 
    756774        Spawnhostiles(); 
    757775        Controlsship(); 
    758776 
    759777        Timer spawnrune = new Timer(); 
    760         spawnrune.Interval = 15; 
     778        spawnrune.Interval = 10; 
    761779        spawnrune.Timeout += Spawnrunes; 
    762780        spawnrune.Start(); 
     
    780798    { 
    781799        ClearAll(); 
     800        //Level.Background.CreateStars(); 
     801        GameObject background = new GameObject(Screen.Width * 2, Screen.Height * 2); 
    782802        Level.Background.CreateStars(); 
    783         Level.CreateBorders(); 
    784         Camera.ZoomToLevel(); 
     803        background.Image = Level.Background.Image; 
     804        Add(background, -3); 
     805        Level.Background.Image = null; 
     806        createedges(); 
     807        //Camera.ZoomToLevel(); 
    785808        Createship(-100, 0); 
    786809        Createship2(100, 0); 
     
    811834    void Spawnrunes() 
    812835    { 
    813         if (runecounter < 5) 
     836        if (runecounter < 6) 
    814837        { 
    815838            int runetype = RandomGen.NextInt(1, 3); 
    816839            double runey = 0.0; 
    817840            double runex = 0.0; 
    818             Vector paikka = Level.GetRandomFreePosition(5.0); 
     841            Vector paikka = GetRandomFreePosition("background", 5.0); 
    819842            runey = paikka.Y; 
    820843            runex = paikka.X; 
     
    856879        } 
    857880    } 
     881 
    858882    void damagerune(PhysicsObject rune, Player ship) 
    859883    { 
    860884        rune.Destroy(); 
    861885        weapon.FireRate *= 2; 
    862         Timer.SingleShot(10.0, delegate { weapon.FireRate /= 2; }); 
    863         MessageDisplay.Add("Firerate improved"); 
     886        Timer.SingleShot(15.0, delegate {  
     887            weapon.FireRate /= 2; } 
     888            ); 
     889        MessageDisplay.Add("Weapons Improved"); 
    864890        MediaPlayer.Play("Damage"); 
    865891        runecounter--; 
     
    877903    // 
    878904    //} 
     905 
     906    /// <summary> 
     907    /// Palauttaa satunnaisen vapaan paikan kentän sisältä. 
     908    /// </summary> 
     909    /// <param name="ignoresTag">Minkätagisia olioita ei huomioida.</param> 
     910    /// <param name="radius">Alueen halkaisija, jonka tulee olla vapaana paikan ympärillä.</param> 
     911    /// <returns>Vapaa paikka.</returns> 
     912    Vector GetRandomFreePosition(String ignoresTag, double radius) 
     913    { 
     914        Vector pos; 
     915        do 
     916        { 
     917            pos = RandomGen.NextVector(Level.Left, Level.Bottom, Level.Right, Level.Top); 
     918 
     919        } while(IsOccupied(pos, ignoresTag, radius)); 
     920        return pos; 
     921    } 
     922 
     923    bool IsOccupied(Vector position, String ignoresTag, double radius) 
     924    { 
     925        GameObject o = GetObjectAt(position, radius); 
     926        if (o == null) return false; 
     927        if (o.Tag.ToString() == ignoresTag) return false; 
     928        return true; 
     929    } 
    879930} 
  • 2013/26/OtsoR/Projekti/Projekti/Projekti/Projekti.csproj

    r4203 r5051  
    6262  </PropertyGroup> 
    6363  <ItemGroup> 
    64     <Reference Include="Jypeli"> 
    65     </Reference> 
    6664    <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86"> 
    6765      <Private>False</Private> 
     
    120118  </ItemGroup> 
    121119  <ItemGroup> 
     120    <ProjectReference Include="..\..\..\Jypeli\Jypeli.csproj"> 
     121      <Project>{74DD1DDD-283D-45D7-A79D-3DCB120708A6}</Project> 
     122      <Name>Jypeli</Name> 
     123    </ProjectReference> 
    122124    <ProjectReference Include="..\ProjektiContent\ProjektiContent.contentproj"> 
    123125      <Name>ProjektiContent</Name> 
Note: See TracChangeset for help on using the changeset viewer.