- Timestamp:
- 2013-07-03 10:43:56 (10 years ago)
- Location:
- 2013/27/TeemuM/Game
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/27/TeemuM/Game/Game/Game/Game.cs
r4381 r4383 59 59 else if (commands[0] == "item") 60 60 { 61 if (player.Give Item(commands[1]))61 if (player.GiveWeapon(commands[1])) 62 62 { 63 63 MessageDisplay.Add("You got " + commands[1] + "!"); … … 67 67 MessageDisplay.Add("What " + commands[1] + "?"); 68 68 } 69 } 70 else if (commands[0] == "powerup") 71 { 72 if (player.PowerUp(commands[1], int.Parse(commands[2]))) 73 MessageDisplay.Add("Activated " + commands[1] + " powerup"); 74 else 75 MessageDisplay.Add("No such powerup"); 69 76 } 70 77 else if (commands[0] == "exit") … … 91 98 Zombie1 zombie1 = new Zombie1(50, 50, 100, 100); 92 99 Add(zombie1); 93 94 Timer z = new Timer();95 z.Interval = 10;96 z.Timeout += delegate { Add(new Zombie1(50, 50, RandomGen.NextDouble(Level.Left, Level.Right), RandomGen.NextDouble(Level.Bottom, Level.Top))); };97 z.Start();98 100 } 99 101 -
2013/27/TeemuM/Game/Game/Game/Player.cs
r4381 r4383 10 10 { 11 11 const double defaultMoveSpeed = 1000; 12 private static Image playerImage = Game.LoadImage("Player"); 13 14 Weapon weapon; 12 15 double speed = defaultMoveSpeed; 13 private static Image image = Game.LoadImage("Player");14 16 15 17 public Player(double width, double height, bool addDefaultControls) : base(width, height) … … 17 19 this.Tag = "player"; 18 20 this.Shape = Shape.Rectangle; 19 this.Image = image;21 this.Image = playerImage; 20 22 this.LinearDamping = 0.9; 21 23 22 24 if (addDefaultControls) 23 Set DefaultControls();25 SetControls(Key.W, Key.S, Key.D, Key.A, MouseButton.Left); 24 26 25 27 this.IsUpdated = true; 26 27 28 28 } 29 29 30 public bool GiveItem(String itemName)30 public bool PowerUp(String type, int value) 31 31 { 32 if ( itemName == "cannon")32 if (type == "speed") 33 33 { 34 Cannon weapon = new Cannon(75, 25); 34 speed = defaultMoveSpeed + value; 35 return true; 36 } 37 38 return false; 39 } 40 41 public bool GiveWeapon(String itemName) 42 { 43 RemoveWeapon(); 44 if (itemName.ToLower() == "cannon") 45 weapon = new Cannon(75, 25); 46 else if (itemName.ToLower() == "plasmacannon") 47 weapon = new PlasmaCannon(75, 25); 48 49 if (weapon != null) 50 { 51 weapon.Angle = Angle.FromDegrees(90); 35 52 this.Add(weapon); 36 53 return true; … … 39 56 } 40 57 41 public void SetDefaultControls()58 public bool RemoveWeapon() 42 59 { 43 Game.Keyboard.Listen(Key.W, ButtonState.Down, delegate { this.Push(new Vector(0, speed)); }, null); 44 Game.Keyboard.Listen(Key.S, ButtonState.Down, delegate { this.Push(new Vector(0, -speed)); }, null); 45 Game.Keyboard.Listen(Key.A, ButtonState.Down, delegate { this.Push(new Vector(-speed, 0)); }, null); 46 Game.Keyboard.Listen(Key.D, ButtonState.Down, delegate { this.Push(new Vector(speed, 0)); }, null); 47 Game.Mouse.Listen(MouseButton.Left, ButtonState.Pressed, Shoot, null); 60 if (weapon != null) 61 { 62 weapon.Destroy(); 63 return true; 64 } 65 return false; 66 } 67 68 public void SetControls(Key forward, Key back, Key right, Key left, MouseButton shoot) 69 { 70 Game.Keyboard.Listen(forward, ButtonState.Down, delegate { MovePlayer(new Vector(0, speed)); }, null); 71 Game.Keyboard.Listen(back, ButtonState.Down, delegate { MovePlayer(new Vector(0, -speed)); }, null); 72 Game.Keyboard.Listen(right, ButtonState.Down, delegate { MovePlayer(new Vector(speed, 0)); }, null); 73 Game.Keyboard.Listen(left, ButtonState.Down, delegate { MovePlayer(new Vector(-speed, 0)); }, null); 74 Game.Mouse.Listen(shoot, ButtonState.Pressed, Shoot, null); 75 } 76 77 private void MovePlayer(Vector force) 78 { 79 this.Push(force); 48 80 } 49 81 50 82 public void Shoot() 51 83 { 52 Game.MessageDisplay.Add("PEW PEW!"); 84 if (weapon != null) 85 weapon.Shoot(); 86 else 87 Game.MessageDisplay.Add("Weapon missing"); 53 88 } 54 89 -
2013/27/TeemuM/Game/Game/Game/bin/x86/Debug/Jypeli.xml
r4381 r4383 659 659 <returns></returns> 660 660 </member> 661 <member name="M:Jypeli.GameObject.SeesObject(Jypeli.GameObject,System.Object)">662 <summary>663 NÀkeekö olio toisen.664 </summary>665 <param name="obj">Toinen olio</param>666 <param name="obstacleTag">Tagi esteelle</param>667 <returns></returns>668 </member>669 <member name="M:Jypeli.GameObject.SeesTarget(Jypeli.Vector)">670 <summary>671 NÀkeekö olio paikkaan.672 </summary>673 <param name="targetPosition">Paikka</param>674 <returns></returns>675 </member>676 <member name="M:Jypeli.GameObject.SeesTarget(Jypeli.Vector,System.Predicate{Jypeli.GameObject})">677 <summary>678 NÀkeekö olio paikkaan.679 </summary>680 <param name="targetPosition">Paikka</param>681 <param name="isObstacle">Ehto sille mikÀ lasketaan esteeksi</param>682 <returns></returns>683 </member>684 <member name="M:Jypeli.GameObject.SeesTarget(Jypeli.Vector,System.Object)">685 <summary>686 NÀkeekö olio paikkaan.687 </summary>688 <param name="targetPosition">Paikka</param>689 <param name="obstacleTag">Tagi esteelle</param>690 <returns></returns>691 </member>692 <member name="M:Jypeli.GameObject.IsBlocking(Jypeli.Vector,Jypeli.Vector)">693 <summary>694 Onko olio kahden paikan vÀlissÀ.695 </summary>696 <param name="obj">Olio</param>697 <param name="pos1">Paikka 1</param>698 <param name="pos2">Paikka 2</param>699 <returns></returns>700 </member>701 661 <member name="M:Jypeli.GameObject.FadeColorTo(Jypeli.Color,System.Double)"> 702 662 <summary> … … 2400 2360 <param name="radius">SÀde jolla etsitÀÀn</param> 2401 2361 <returns>Mahdollinen olio</returns> 2402 </member>2403 <member name="M:Jypeli.Game.GetObjectsBetween(Jypeli.Vector,Jypeli.Vector)">2404 <summary>2405 Palauttaa pelioliot kahden pisteen vÀlillÀ.2406 </summary>2407 <param name="pos1"></param>2408 <param name="pos2"></param>2409 <returns></returns>2410 2362 </member> 2411 2363 <member name="M:Jypeli.Game.LoadAnimation(System.String)"> … … 6926 6878 </summary> 6927 6879 </member> 6928 <member name="F:Jypeli.Widgets.MultiSelectWindow.QuestionLabel">6929 <summary>6930 Kysymys.6931 </summary>6932 </member>6933 6880 <member name="M:Jypeli.Widgets.MultiSelectWindow.#ctor(System.String,System.String[])"> 6934 6881 <summary> … … 6954 6901 </summary> 6955 6902 </member> 6956 <member name="P:Jypeli.Widgets.MultiSelectWindow.SelectedIndex">6957 <summary>6958 Kuinka mones nappula on valittuna (alkaa nollasta)6959 </summary>6960 </member>6961 6903 <member name="P:Jypeli.Widgets.MultiSelectWindow.SelectedButton"> 6962 6904 <summary> … … 6972 6914 <summary> 6973 6915 Valitun nappulan vÀri. 6974 </summary>6975 </member>6976 <member name="P:Jypeli.Widgets.MultiSelectWindow.RememberSelection">6977 <summary>6978 Muistetaanko missÀ kohtaa kursori oli viime kerralla kun ikkuna nÀytettiin.6979 6916 </summary> 6980 6917 </member> … … 10439 10376 </summary> 10440 10377 </member> 10441 <member name="P:PlatformCharacter.TurnsWhenWalking">10442 <summary>10443 KÀÀntyykö hahmo automaattisesti kun se kÀvelee.10444 </summary>10445 </member>10446 10378 <member name="P:PlatformCharacter.Weapon"> 10447 10379 <summary> … … 11805 11737 <summary> 11806 11738 KentÀn keskipiste. 11807 </summary>11808 </member>11809 <member name="M:Jypeli.Level.Clear">11810 <summary>11811 Palauttaa oletustaustan.11812 11739 </summary> 11813 11740 </member> -
2013/27/TeemuM/Game/Game/Game/obj/x86/Debug/ContentPipeline-{7DE21D26-C0FA-4B3B-93A6-C0EF7849F918}.xml
r4365 r4383 10 10 <Output>C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Player.xnb</Output> 11 11 <Time>2013-07-02T13:02:38.9536571+03:00</Time> 12 </Item> 13 <Item> 14 <Source>Zombie1.png</Source> 15 <Name>Zombie1</Name> 16 <Importer>TextureImporter</Importer> 17 <Processor>TextureProcessor</Processor> 18 <Options>None</Options> 19 <Output>C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Zombie1.xnb</Output> 20 <Time>2013-07-03T09:32:33.2154956+03:00</Time> 21 </Item> 22 <Item> 23 <Source>Zombie2.png</Source> 24 <Name>Zombie2</Name> 25 <Importer>TextureImporter</Importer> 26 <Processor>TextureProcessor</Processor> 27 <Options>None</Options> 28 <Output>C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Zombie2.xnb</Output> 29 <Time>2013-07-03T09:32:33.2254956+03:00</Time> 30 </Item> 31 <Item> 32 <Source>Zombie3.png</Source> 33 <Name>Zombie3</Name> 34 <Importer>TextureImporter</Importer> 35 <Processor>TextureProcessor</Processor> 36 <Options>None</Options> 37 <Output>C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Zombie3.xnb</Output> 38 <Time>2013-07-03T09:32:33.2254956+03:00</Time> 39 </Item> 40 <Item> 41 <Source>Zombie4.png</Source> 42 <Name>Zombie4</Name> 43 <Importer>TextureImporter</Importer> 44 <Processor>TextureProcessor</Processor> 45 <Options>None</Options> 46 <Output>C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Zombie4.xnb</Output> 47 <Time>2013-07-03T09:32:33.2354956+03:00</Time> 12 48 </Item> 13 49 <BuildSuccessful>true</BuildSuccessful> -
2013/27/TeemuM/Game/Game/Game/obj/x86/Debug/Game.csproj.FileListAbsolute.txt
r4381 r4383 64 64 C:\Users\Teemu\Desktop\TeemuM\Game\Game\Game\bin\x86\Debug\Jypeli.xml 65 65 C:\Users\Teemu\Desktop\TeemuM\Game\Game\Game\obj\x86\Debug\Game.pdb 66 C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Zombie1.xnb 67 C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Zombie2.xnb 68 C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Zombie3.xnb 69 C:\MyTemp\jumakall\TeemuM\Game\Game\Game\bin\x86\Debug\Content\Zombie4.xnb
Note: See TracChangeset
for help on using the changeset viewer.