Changeset 9654


Ignore:
Timestamp:
2018-06-07 12:00:51 (20 months ago)
Author:
dasilven
Message:
 
Location:
2018/23/DANIELS
Files:
15 added
10 edited

Legend:

Unmodified
Added
Removed
  • 2018/23/DANIELS/drdodger/drdodger/Content/Content.mgcb

    r9629 r9654  
    6363/build:xpcostume.png 
    6464 
     65#begin player2costume.png 
     66/importer:TextureImporter 
     67/processor:TextureProcessor 
     68/processorParam:ColorKeyColor=255,0,255,255 
     69/processorParam:ColorKeyEnabled=True 
     70/processorParam:GenerateMipmaps=False 
     71/processorParam:PremultiplyAlpha=True 
     72/processorParam:ResizeToPowerOfTwo=False 
     73/processorParam:MakeSquare=False 
     74/processorParam:TextureFormat=Color 
     75/build:player2costume.png 
     76 
     77#begin player2costumelov.png 
     78/importer:TextureImporter 
     79/processor:TextureProcessor 
     80/processorParam:ColorKeyColor=255,0,255,255 
     81/processorParam:ColorKeyEnabled=True 
     82/processorParam:GenerateMipmaps=False 
     83/processorParam:PremultiplyAlpha=True 
     84/processorParam:ResizeToPowerOfTwo=False 
     85/processorParam:MakeSquare=False 
     86/processorParam:TextureFormat=Color 
     87/build:player2costumelov.png 
     88 
     89#begin playercostumelov.png 
     90/importer:TextureImporter 
     91/processor:TextureProcessor 
     92/processorParam:ColorKeyColor=255,0,255,255 
     93/processorParam:ColorKeyEnabled=True 
     94/processorParam:GenerateMipmaps=False 
     95/processorParam:PremultiplyAlpha=True 
     96/processorParam:ResizeToPowerOfTwo=False 
     97/processorParam:MakeSquare=False 
     98/processorParam:TextureFormat=Color 
     99/build:playercostumelov.png 
     100 
  • 2018/23/DANIELS/drdodger/drdodger/Content/obj/Windows/.mgcontent

    r9629 r9654  
    99    <File>C:/MyTemp/pelikurssi2018/viikko23/DANIELS/drdodger/drdodger/Content/enemycostume.png</File> 
    1010    <File>C:/MyTemp/pelikurssi2018/viikko23/DANIELS/drdodger/drdodger/Content/xpcostume.png</File> 
     11    <File>C:/MyTemp/pelikurssi2018/viikko23/DANIELS/drdodger/drdodger/Content/player2costume.png</File> 
     12    <File>C:/MyTemp/pelikurssi2018/viikko23/DANIELS/drdodger/drdodger/Content/player2costumelov.png</File> 
     13    <File>C:/MyTemp/pelikurssi2018/viikko23/DANIELS/drdodger/drdodger/Content/playercostumelov.png</File> 
    1114  </SourceFiles> 
    1215</SourceFileCollection> 
  • 2018/23/DANIELS/drdodger/drdodger/drdodger.cs

    r9629 r9654  
    99{ 
    1010    PhysicsObject player; 
    11  
     11    PhysicsObject player2; 
    1212    PhysicsObject xp; 
    1313    PhysicsObject enemy1; 
     
    1919    Image enemycos = LoadImage("enemycostume"); 
    2020    Image playercos = LoadImage("playercostume"); 
     21    Image playerlovcos = LoadImage("playercostumelov"); 
    2122    Image bgcos = LoadImage("spacebg"); 
    2223    Image xpcos = LoadImage("xpcostume"); 
     24    Image player2cos = LoadImage("player2costume"); 
     25    Image playerlov2cos = LoadImage("player2costumelov"); 
    2326    public override void Begin() 
    2427    { 
    2528        // Kirjoita ohjelmakoodisi tähän 
    26         MessageWindow aloitus = new MessageWindow("aloita peli"); 
     29        MultiSelectWindow aloitus = new MultiSelectWindow("choose gamemode (offline)", 
     30      "1 player (singleplayer)", "2 players (multiplayer)"); 
     31        aloitus.AddItemHandler(0, players1); 
     32        aloitus.AddItemHandler(1, players2); 
    2733        Add(aloitus); 
    28         AsetaOhjaimet(); 
     34 
     35         
     36 
     37 
    2938        Level.Background.Image = bgcos; 
    3039        Level.Background.Size = Screen.Size; 
     40 
    3141        player = new PhysicsObject(40, 40); 
    3242        player.Shape = Shape.Circle; 
    3343        player.Color = Color.Green; 
    3444        LisaaLaskurit(); 
    35         player.Position = new Vector(0, 0); 
     45        player.Position = new Vector(30, 0); 
    3646        player.Image = playercos; 
    37         Add(player); 
    3847        player.CanRotate = false; 
     48 
     49        player2 = new PhysicsObject(40, 40); 
     50        player2.Shape = Shape.Circle; 
     51        player2.Color = Color.Red; 
     52        player2.Position = new Vector(-30, 0); 
     53        player2.Image = player2cos; 
     54        player2.CanRotate = false; 
     55        AddCollisionHandler(player, player2, firstouch); 
    3956         
     57 
    4058        xp = new PhysicsObject(20, 20); 
    4159        xp.Shape = Shape.Star; 
     
    4563        Add(xp); 
    4664        xp.CanRotate = false; 
     65 
    4766        enemy1 = new PhysicsObject(35, 35); 
    4867        enemy1.Color = Color.Red; 
     
    6786        AddCollisionHandler(player, enemy3, Died); 
    6887 
     88        AddCollisionHandler(player2, enemy1, Died); 
     89        AddCollisionHandler(player2, enemy2, Died); 
     90        AddCollisionHandler(player2, enemy3, Died); 
     91 
    6992 
    7093 
    7194        AddCollisionHandler(player, xp, PelaajaTormasi); 
     95        AddCollisionHandler(player2, xp, PelaajaTormasi); 
    7296 
    7397        Level.CreateBorders(1.02, false,Color.Transparent); 
    7498 
    75         PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); 
    76         Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); 
     99        AsetaOhjaimet(); 
    77100    } 
    78101    void AsetaOhjaimet() 
    79102    { 
    80         Keyboard.Listen(Key.D, ButtonState.Down, liike, null, player, new Vector(200,0 )); 
    81         Keyboard.Listen(Key.D, ButtonState.Released, liike, null, player, new Vector(0, 0)); 
    82  
    83         Keyboard.Listen(Key.S, ButtonState.Down, liike, null, player, new Vector(0, -200)); 
    84         Keyboard.Listen(Key.S, ButtonState.Released, liike, null, player, new Vector(0, 0)); 
    85  
    86         Keyboard.Listen(Key.W, ButtonState.Down, liike, null, player, new Vector(0, 200)); 
    87         Keyboard.Listen(Key.W, ButtonState.Released, liike, null, player, new Vector(0, 0)); 
    88  
    89         Keyboard.Listen(Key.A, ButtonState.Down, liike, null, player, new Vector(-200, 0)); 
    90         Keyboard.Listen(Key.A, ButtonState.Released, liike, null, player, new Vector(0, 0)); 
    91  
     103        //player 
     104        Keyboard.Listen(Key.Right, ButtonState.Down, liike, null, player, new Vector(200,0 )); 
     105        Keyboard.Listen(Key.Right, ButtonState.Released, liike, null, player, new Vector(0, 0)); 
     106 
     107        Keyboard.Listen(Key.Down, ButtonState.Down, liike, null, player, new Vector(0, -200)); 
     108        Keyboard.Listen(Key.Down, ButtonState.Released, liike, null, player, new Vector(0, 0)); 
     109 
     110        Keyboard.Listen(Key.Up, ButtonState.Down, liike, null, player, new Vector(0, 200)); 
     111        Keyboard.Listen(Key.Up, ButtonState.Released, liike, null, player, new Vector(0, 0)); 
     112 
     113        Keyboard.Listen(Key.Left, ButtonState.Down, liike, null, player, new Vector(-200, 0)); 
     114        Keyboard.Listen(Key.Left, ButtonState.Released, liike, null, player, new Vector(0, 0)); 
     115 
     116        //quitting 
     117        Keyboard.Listen(Key.Escape, ButtonState.Down, pausemenu, "pause"); 
     118 
     119        //cheats activation key 
    92120        Keyboard.Listen(Key.F1, ButtonState.Down, cheats, null ); 
    93121 
    94  
    95     } 
    96  
    97     void liike(PhysicsObject pelaaja, Vector nopeus) 
     122    } 
     123 
     124    void liike(PhysicsObject player, Vector nopeus) 
    98125    { 
    99126        player.Push(nopeus); 
     
    111138        xp.Position = new Vector (xpos2, ypos2); 
    112139        AddCollisionHandler(player, xp, PelaajaTormasi); 
     140        AddCollisionHandler(player2, xp, PelaajaTormasi); 
    113141        xp.Image = xpcos; 
    114142        Add(xp); 
     
    125153 
    126154    } 
     155 
    127156    void LisaaLaskurit() 
    128157    { 
     
    150179    { 
    151180        player.Destroy(); 
     181        player2.Destroy(); 
    152182        MultiSelectWindow alkuValikko = new MultiSelectWindow("kuolit", 
    153183"Aloita alusta", "Lopeta peli"); 
     
    166196    void cheats() 
    167197    { 
    168         MultiSelectWindow cheatsmenu = new MultiSelectWindow("Cheats", 
    169 "Spawn Extra Xp", "Remove Enemies","return removed enemies","give 100xp","starmode on","starmode off","next..."); 
     198        MultiSelectWindow cheatsmenu = new MultiSelectWindow("Cheats(1)", 
     199"Spawn Extra Xp", "Remove Enemies","return removed enemies","give 100xp","starmode on","starmode off","next...","exit"); 
    170200        cheatsmenu.AddItemHandler(0, spawnxpx1); 
    171201        cheatsmenu.AddItemHandler(1, noenemys); 
     
    175205        cheatsmenu.AddItemHandler(5, starmodeoff); 
    176206        cheatsmenu.AddItemHandler(6, cheats2); 
     207        cheatsmenu.AddItemHandler(7, null); 
    177208 
    178209 
     
    186217    void cheats2() 
    187218    { 
    188         MultiSelectWindow cheatsmenu2 = new MultiSelectWindow("Cheats", 
    189 "1k more xp", "enemies turn into players on", "enemies turn into players off", "enemymode on", "enemymode off", "back...", "next..."); 
     219        MultiSelectWindow cheatsmenu2 = new MultiSelectWindow("Cheats(2)", 
     220"1k more xp", "enemies turn into players on", "enemies turn into players off", "enemymode on", "enemymode off", "back...", "next...","exit"); 
    190221        cheatsmenu2.AddItemHandler(0, givexp1k); 
    191222        cheatsmenu2.AddItemHandler(1, etipon); 
     
    195226        cheatsmenu2.AddItemHandler(5, cheats); 
    196227        cheatsmenu2.AddItemHandler(6, cheats3); 
     228        cheatsmenu2.AddItemHandler(7, null); 
    197229 
    198230        Add(cheatsmenu2); 
     
    201233    void cheats3() 
    202234    { 
    203         MultiSelectWindow cheatsmenu3 = new MultiSelectWindow("Cheats", 
    204       "enemy is xp mode on", "enemy is xp mode off", "spawn boss", "bossmode on", "bossmode off", "back...", "next..."); 
     235        MultiSelectWindow cheatsmenu3 = new MultiSelectWindow("Cheats(3)", 
     236      "enemy is xp mode on", "enemy is xp mode off", "spawn boss", "bossmode on", "bossmode off", "back...", "next...","exit"); 
    205237        cheatsmenu3.AddItemHandler(0, enemyisxpon); 
    206238        cheatsmenu3.AddItemHandler(1, enemyisxpoff); 
    207239        cheatsmenu3.AddItemHandler(2, spawnboss); 
    208240        cheatsmenu3.AddItemHandler(3, bossmodeon); 
    209         cheatsmenu3.AddItemHandler(4, bossmodeon); 
     241        cheatsmenu3.AddItemHandler(4, bossmodeoff); 
    210242        cheatsmenu3.AddItemHandler(5, cheats2); 
    211         cheatsmenu3.AddItemHandler(6, cheats3); 
     243        cheatsmenu3.AddItemHandler(6, cheats4); 
     244        cheatsmenu3.AddItemHandler(7, null); 
    212245        Add(cheatsmenu3); 
     246    } 
     247 
     248    void cheats4() 
     249    { 
     250        MultiSelectWindow cheatsmenu4 = new MultiSelectWindow("Cheats (4)", 
     251      "no death on", "no death off","back...","exit"); 
     252        cheatsmenu4.AddItemHandler(0, nodeathon); 
     253        cheatsmenu4.AddItemHandler(1, nodeathoff); 
     254        cheatsmenu4.AddItemHandler(2, cheats3); 
     255        cheatsmenu4.AddItemHandler(3, null); 
     256        Add(cheatsmenu4); 
    213257    } 
    214258    void spawnxpx1() 
     
    254298        AddCollisionHandler(player, enemy2, Died); 
    255299        AddCollisionHandler(player, enemy3, Died); 
     300        AddCollisionHandler(player2, enemy1, Died); 
     301        AddCollisionHandler(player2, enemy2, Died); 
     302        AddCollisionHandler(player2, enemy3, Died); 
    256303    } 
    257304    void spawn100xp() 
     
    263310    { 
    264311        player.Image = xpcos; 
     312        player2.Image = xpcos; 
    265313 
    266314    } 
     
    268316    { 
    269317        player.Image = playercos; 
     318        player2.Image = player2cos; 
    270319    } 
    271320    void givexp1k() 
     
    277326    { 
    278327        player.Image = enemycos; 
     328        player2.Image = enemycos; 
    279329    } 
    280330    void enemymodeoff() 
    281331    { 
    282332        player.Image = playercos; 
     333        player2.Image = player2cos; 
    283334    } 
    284335    void etipon() 
     
    317368        Add(xpbos); 
    318369        AddCollisionHandler(player, xpbos, boskilled); 
     370        AddCollisionHandler(player2, xpbos, boskilled); 
    319371    } 
    320372    void boskilled(PhysicsObject tormaaja, PhysicsObject kohde) 
     
    327379    { 
    328380        player.Size = new Vector(350, 350); 
     381        player2.Size = new Vector(350, 350); 
    329382    } 
    330383    void bossmodeoff() 
    331384    { 
    332385        player.Size = new Vector(40, 40); 
    333     } 
    334  
     386        player2.Size = new Vector(40, 40); 
     387    } 
     388    void nodeathon() 
     389    { 
     390        RemoveCollisionHandlers(player, enemy1); 
     391        RemoveCollisionHandlers(player, enemy2); 
     392        RemoveCollisionHandlers(player, enemy3); 
     393 
     394        RemoveCollisionHandlers(player2, enemy1); 
     395        RemoveCollisionHandlers(player2, enemy2); 
     396        RemoveCollisionHandlers(player2, enemy3); 
     397    } 
     398    void nodeathoff() 
     399    { 
     400        AddCollisionHandler(player, enemy1, Died); 
     401        AddCollisionHandler(player, enemy2, Died); 
     402        AddCollisionHandler(player, enemy3, Died); 
     403 
     404        AddCollisionHandler(player2, enemy1, Died); 
     405        AddCollisionHandler(player2, enemy2, Died); 
     406        AddCollisionHandler(player2, enemy3, Died); 
     407    } 
     408    void players1() 
     409    { 
     410        Add(player); 
     411    } 
     412    void players2() 
     413    { 
     414        Add(player); 
     415        Add(player2); 
     416        //player2 
     417        Keyboard.Listen(Key.D, ButtonState.Down, liike, null, player2, new Vector(200, 0)); 
     418        Keyboard.Listen(Key.D, ButtonState.Released, liike, null, player2, new Vector(0, 0)); 
     419 
     420        Keyboard.Listen(Key.S, ButtonState.Down, liike, null, player2, new Vector(0, -200)); 
     421        Keyboard.Listen(Key.S, ButtonState.Released, liike, null, player2, new Vector(0, 0)); 
     422 
     423        Keyboard.Listen(Key.W, ButtonState.Down, liike, null, player2, new Vector(0, 200)); 
     424        Keyboard.Listen(Key.W, ButtonState.Released, liike, null, player2, new Vector(0, 0)); 
     425 
     426        Keyboard.Listen(Key.A, ButtonState.Down, liike, null, player2, new Vector(-200, 0)); 
     427        Keyboard.Listen(Key.A, ButtonState.Released, liike, null, player2, new Vector(0, 0)); 
     428 
     429    } 
     430    void firstouch(PhysicsObject tormaaja, PhysicsObject kohde) 
     431    { 
     432        player.Image = playerlovcos; 
     433        player2.Image = playerlov2cos; 
     434        Timer ajastin = new Timer(); 
     435        ajastin.Interval = 0.5; 
     436        ajastin.Timeout += delegate { 
     437            player.Image = playercos; 
     438            player2.Image = player2cos; 
     439        }; 
     440        ajastin.Start(); 
     441    } 
     442    void pausemenu() 
     443    { 
     444        MultiSelectWindow pause = new MultiSelectWindow("menu", 
     445      "Resume", "Restart","Help","Quit"); 
     446        pause.AddItemHandler(0, null); 
     447        pause.AddItemHandler(1, restart); 
     448        pause.AddItemHandler(2, gethelp); 
     449        pause.AddItemHandler(3, Exit); 
     450        Add(pause); 
     451    } 
     452    void gethelp() 
     453    { 
     454        MessageWindow info = new MessageWindow("nuolinapit= pelaaja1 liiku           " + " w.a.s.d= pelaaja2 liiku"); 
     455        Add(info); 
     456 
     457 
     458 
     459 
     460    } 
    335461} 
  • 2018/23/DANIELS/drdodger/drdodger/obj/x86/Debug/drdodger.csproj.FileListAbsolute.txt

    r9629 r9654  
    3131C:\MyTemp\pelikurssi2018\viikko23\DANIELS\drdodger\drdodger\bin\Windows\Debug\Content\spacebg.xnb 
    3232C:\MyTemp\pelikurssi2018\viikko23\DANIELS\drdodger\drdodger\bin\Windows\Debug\Content\xpcostume.xnb 
     33C:\MyTemp\pelikurssi2018\viikko23\DANIELS\drdodger\drdodger\bin\Windows\Debug\Content\player2costume.xnb 
     34C:\MyTemp\pelikurssi2018\viikko23\DANIELS\drdodger\drdodger\bin\Windows\Debug\Content\player2costumelov.xnb 
     35C:\MyTemp\pelikurssi2018\viikko23\DANIELS\drdodger\drdodger\bin\Windows\Debug\Content\playercostumelov.xnb 
Note: See TracChangeset for help on using the changeset viewer.