Changeset 7188


Ignore:
Timestamp:
2016-06-07 15:27:11 (3 years ago)
Author:
empaheik
Message:
 
Location:
2016/23/ohjaajat
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • 2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Player.cs

    r7184 r7188  
    77using Jypeli.Widgets; 
    88 
    9 public class Player : PlatformCharacter 
     9public class Player : PlatformCharacter2 
    1010{ 
    1111 
     
    1515        Image = pic; 
    1616        Color = color; 
     17 
     18        Mass = 10.0; 
    1719    } 
    1820} 
  • 2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Punasininen.cs

    r7186 r7188  
    99public class Punasininen : PhysicsGame 
    1010{ 
    11     private const double nopeus = 200; 
    12     private const double hyppyNopeus = 750; 
     11    private const double SPEED = 450; 
     12    private const double JUMPSPEED = 1250; 
    1313    private const int RUUDUN_KOKO = 40; 
    1414 
     
    3030    void CreateLevel() 
    3131    { 
     32        Gravity = new Vector(0, -1000); 
     33 
    3234        ColorTileMap map = ColorTileMap.FromLevelAsset("dungeon1"); 
    3335        map.SetTileMethod(Color.Black, LisaaTaso); 
     
    5658        Add(player); 
    5759        return player; 
     60 
    5861    } 
    5962 
     
    6366 
    6467        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); 
    6669        ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, Aim, "Tähtää", red); 
    6770 
    6871        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); 
    7073        ControllerOne.ListenAnalog(AnalogControl.RightStick, 0.1, Aim, null, blue); 
    7174 
     
    7477    } 
    7578 
    76     void Move(AnalogState tatinTila, Player player) 
     79    void Move(AnalogState stick, Player player) 
    7780    { 
    78  
     81        if (stick.StateVector.Magnitude > 0.15) 
     82            player.Walk(stick.StateVector.X > 0 ? Direction.Right : Direction.Left); 
    7983    } 
    8084 
    8185    void Jump(Player player, double speed) 
    8286    { 
    83  
     87        player.Jump(speed); 
    8488    } 
    8589 
Note: See TracChangeset for help on using the changeset viewer.