- Timestamp:
- 2016-06-07 15:27:11 (7 years ago)
- Location:
- 2016/23/ohjaajat
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Player.cs
r7184 r7188 7 7 using Jypeli.Widgets; 8 8 9 public class Player : PlatformCharacter 9 public class Player : PlatformCharacter2 10 10 { 11 11 … … 15 15 Image = pic; 16 16 Color = color; 17 18 Mass = 10.0; 17 19 } 18 20 } -
2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Punasininen.cs
r7186 r7188 9 9 public class Punasininen : PhysicsGame 10 10 { 11 private const double nopeus = 200;12 private const double hyppyNopeus = 750;11 private const double SPEED = 450; 12 private const double JUMPSPEED = 1250; 13 13 private const int RUUDUN_KOKO = 40; 14 14 … … 30 30 void CreateLevel() 31 31 { 32 Gravity = new Vector(0, -1000); 33 32 34 ColorTileMap map = ColorTileMap.FromLevelAsset("dungeon1"); 33 35 map.SetTileMethod(Color.Black, LisaaTaso); … … 56 58 Add(player); 57 59 return player; 60 58 61 } 59 62 … … 63 66 64 67 ControllerOne.ListenAnalog(AnalogControl.LeftStick, 0.1, Move, "Liikuta pelaajaa", red); 65 ControllerOne.Listen(Button.A, ButtonState.Pressed, Jump, "Pelaaja hyppää", red, hyppyNopeus);68 ControllerOne.Listen(Button.A, ButtonState.Pressed, Jump, "Pelaaja hyppää", red, JUMPSPEED); 66 69 ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, Aim, "Tähtää", red); 67 70 68 71 ControllerTwo.ListenAnalog(AnalogControl.LeftStick, 0.1, Move, "Liikuta pelaajaa", blue); 69 ControllerTwo.Listen(Button.A, ButtonState.Pressed, Jump, "Pelaaja hyppää", blue, hyppyNopeus);72 ControllerTwo.Listen(Button.A, ButtonState.Pressed, Jump, "Pelaaja hyppää", blue, JUMPSPEED); 70 73 ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, Aim, null, blue); 71 74 … … 74 77 } 75 78 76 void Move(AnalogState tatinTila, Player player)79 void Move(AnalogState stick, Player player) 77 80 { 78 81 if (stick.StateVector.Magnitude > 0.15) 82 player.Walk(stick.StateVector.X > 0 ? Direction.Right : Direction.Left); 79 83 } 80 84 81 85 void Jump(Player player, double speed) 82 86 { 83 87 player.Jump(speed); 84 88 } 85 89
Note: See TracChangeset
for help on using the changeset viewer.