Changeset 7211 for 2016/23/ohjaajat


Ignore:
Timestamp:
2016-06-09 09:08:18 (3 years ago)
Author:
sieerinn
Message:

Aseita ja tähtääminen

Location:
2016/23/ohjaajat/Punasininen/Punasininen
Files:
4 edited

Legend:

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

    r7210 r7211  
    1313    public Vector Spawn; 
    1414 
    15     public Player(double leveys, double korkeus, Image pic, Color color) 
     15    public Player(double leveys, double korkeus, Color color) 
    1616        : base(leveys, korkeus) 
    1717    { 
    18         Image = pic; 
    1918        Color = color; 
    2019        CanRotate = false; 
  • 2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Punasininen.cs

    r7210 r7211  
    2323    private Image blueGlow = LoadImage("blueglow"); 
    2424 
    25     private Image bluepic; 
    26     private Image redpic; 
    27  
    2825    Color blueColor = Color.FromHexCode("FF1D65CF"); 
    2926    Color redColor = Color.FromHexCode("FABE1A"); 
     
    3835    public override void Begin() 
    3936    { 
    40  
    41         IsMouseVisible = true; // <- voi ottaa pois 
    4237        shader = new Shader(GraphicsDevice, Content, Camera); 
    4338 
    44         //Gravity = new Vector(0, -1000); 
    4539        CreateLevel(); 
    4640        AddControls(); 
     
    6357        ColorTileMap map = ColorTileMap.FromLevelAsset("dungeon1"); 
    6458        map.SetTileMethod(Color.Black, AddPlatform); 
    65         map.SetTileMethod(Color.FromHexCode("#FF0026FF"), delegate(Vector paikka, double leveys, double korkeus) { blue = CreatePlayer(paikka, leveys, korkeus, bluepic, blueColor);}); 
     59        map.SetTileMethod(Color.FromHexCode("#FF0026FF"), delegate(Vector paikka, double leveys, double korkeus) { blue = CreatePlayer(paikka, leveys, korkeus, blueColor, blueWalkImages, bluePistolpic);}); 
    6660        map.SetTileMethod(Color.FromHexCode("FFD800"), CreateWeaponCrate); 
    67         map.SetTileMethod(Color.Red, delegate(Vector paikka, double leveys, double korkeus) { red = CreatePlayer(paikka, leveys, korkeus, redpic, redColor); }); 
     61        map.SetTileMethod(Color.Red, delegate(Vector paikka, double leveys, double korkeus) { red = CreatePlayer(paikka, leveys, korkeus, redColor, orangeWalkImages, orangePistolpic); }); 
    6862        map.Execute(TILE_SIZE, TILE_SIZE); 
    6963 
    7064        Surface bottom = Surface.CreateBottom(Level); 
    71         bottom.Width *= 2; 
     65        bottom.Width *= 5; 
    7266        bottom.Y -= Level.Height / 2; 
    7367        bottom.Tag = "death"; 
     68        bottom.Color = Color.HanPurple; //terveisin 
    7469        Add(bottom); 
    7570 
     
    10398    } 
    10499 
    105     Player CreatePlayer(Vector paikka, double leveys, double korkeus, Image playerspic, Color playersColor) 
    106     { 
    107         Player player = new Player(leveys * 1.1, korkeus * 1.5, playerspic, playersColor); 
    108         player.AnimWalk = new Animation(blueWalkImages) { FPS = 30 }; 
    109         player.AnimIdle = new Animation(new[] { blueWalkImages[0] }); 
    110         player.Position = paikka; 
    111         player.Spawn = paikka; 
     100    Player CreatePlayer(Vector paikka, double leveys, double korkeus, Color playersColor, Image[] animation, Image pistolPic) 
     101    { 
     102        Player player = new Player(leveys * 1, korkeus * 1.5, playersColor); 
     103        player.AnimWalk = new Animation(animation) { FPS = 30 }; 
     104        player.AnimIdle = new Animation(new[] { animation[0] }); 
     105        player.Position = paikka + new Vector(0, korkeus/2); 
     106        player.Spawn = player.Position; 
    112107        Add(player); 
    113108 
     
    118113            MaxAmmoLifetime = TimeSpan.FromSeconds(8), 
    119114            ProjectileCollision = BulletHitsSomething, 
    120             Image = bluePistolpic, 
     115            Image = pistolPic, 
    121116            Y = 5 
    122117        }; 
     
    128123        AddCollisionHandler(player, "crate", delegate(PhysicsObject a, PhysicsObject b) 
    129124        { 
    130             //((Player)a).Weapon = ((WeaponCrate)b).GiveWeapon();  
    131             player.Weapon = GunLottery(); 
     125            GunLottery(player); 
    132126            b.Destroy(); 
    133127        }); 
     
    162156    } 
    163157 
    164     Weapon GunLottery() 
    165     { 
    166         return new AssaultRifle(TILE_SIZE / 2, TILE_SIZE / 2) { FireRate = 1.5, AttackSound = null, MaxAmmoLifetime = TimeSpan.FromSeconds(8), ProjectileCollision = BulletHitsSomething }; 
     158    void GunLottery(Player player) 
     159    { 
     160        player.Weapon = new ColorGun(player.Weapon.Width, player.Weapon.Height, player.Weapon.Image, player, this); 
    167161    } 
    168162 
     
    183177    } 
    184178 
    185     void ColorTile(PhysicsObject player, PhysicsObject platform) 
     179    public void ColorTile(PhysicsObject player, PhysicsObject platform) 
    186180    { 
    187181        var imgs = player.Color == blueColor? blueTileImages : orangeTileImages; 
     
    241235    void Aim(AnalogState stickState, Player player) 
    242236    { 
    243  
     237        player.Weapon.Angle = stickState.StateVector.Angle; 
    244238    } 
    245239 
  • 2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/WeaponCrate.cs

    r7203 r7211  
    99class WeaponCrate : PhysicsObject 
    1010{ 
    11  
    1211    public WeaponCrate(double leveys, double korkeus) 
    1312        : base(leveys, korkeus) 
     
    1514        Tag = "crate"; 
    1615    } 
     16} 
    1717 
    18     /* 
    19     public Weapon GiveWeapon() 
     18class ColorGun : Weapon 
     19{ 
     20    public Player Owner; 
     21 
     22    public Game MyGame; 
     23 
     24    protected override PhysicsObject CreateProjectile() 
    2025    { 
    21         this.Destroy(); 
    22     }*/ 
     26        Grenade test = new Grenade(10, TimeSpan.FromSeconds(1)); 
     27        test.Explosion.ShockwaveColor = Owner.Color; 
     28        return test; 
     29    } 
     30 
     31    public ColorGun(double leveys, double korkeus, Image image, Player owner, Game game) 
     32        : base(leveys, korkeus) 
     33    { 
     34        Image = image; 
     35        AttackSound = null; 
     36        FireRate = 1; 
     37        Power.DefaultValue = 15000; 
     38        Owner = owner; 
     39        MyGame = game; 
     40        
     41    } 
    2342} 
Note: See TracChangeset for help on using the changeset viewer.