Changeset 7208


Ignore:
Timestamp:
2016-06-08 13:26:10 (3 years ago)
Author:
sieerinn
Message:

Tiili animaatiot

Location:
2016/23/ohjaajat/Punasininen/Punasininen
Files:
1 added
26 edited

Legend:

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

    r7206 r7208  
    1616    private Player blue; 
    1717    private Player red; 
    18     private Image[] orangeTileImages = LoadImages("bluetile\\bluetile", 12); 
    19     private Image[] blueTileImages; 
     18    private Image[] orangeTileImages = LoadImages("orangetile\\orangetile", 12); 
     19    private Image[] blueTileImages = LoadImages("bluetile\\bluetile", 12); 
    2020    private Image orangeGlow = LoadImage("orangeglow"); 
    2121    private Image blueGlow = LoadImage("blueglow"); 
     
    4646        for (int i = 1; i <= numberOfImages; i++) 
    4747        { 
    48             images[i-1] = LoadImage(string.Format("{0}{1:0000}", prefix, numberOfImages)); 
     48            images[i-1] = LoadImage(string.Format("{0}{1:0000}", prefix, i)); 
    4949        } 
    5050        return images; 
     
    8484    void AddPlatform(Vector paikka, double leveys, double korkeus) 
    8585    { 
    86         PhysicsObject platform = PhysicsObject.CreateStaticObject(leveys, korkeus); 
     86        Tile platform = new Tile(leveys, korkeus); 
     87        platform.MakeStatic(); 
    8788        platform.Position = paikka; 
    8889        platform.Color = Color.Black; 
     
    153154    void ColorTile(PhysicsObject player, PhysicsObject platform) 
    154155    { 
    155         GameObject glow = platform.Objects.FirstOrDefault(); 
    156         if (glow == null) 
    157         { 
    158             glow = new GameObject(TILE_SIZE * 7, TILE_SIZE * 7); 
    159             platform.Add(glow); 
    160         } 
    161         glow.Image = player.Color == Color.Blue? blueGlow : orangeGlow; 
    162         platform.Color = player.Color; 
     156        var imgs = player.Color == Color.Blue? blueTileImages : orangeTileImages; 
     157        var glowImg = player.Color == Color.Blue ? blueGlow : orangeGlow; 
     158        ((Tile)platform).SetColor(imgs, glowImg, player.Color); 
    163159 
    164160        List<GameObject> colored = GetObjects(o => (o.Color == red.Color || o.Color == blue.Color) && (String)o.Tag == "platform"); 
  • 2016/23/ohjaajat/Punasininen/Punasininen/Punasininen/Punasininen.csproj

    r7198 r7208  
    116116    <Compile Include="Properties\AssemblyInfo.cs" /> 
    117117    <Compile Include="Shader.cs" /> 
     118    <Compile Include="Tile.cs" /> 
    118119    <Compile Include="WeaponCrate.cs" /> 
    119120  </ItemGroup> 
Note: See TracChangeset for help on using the changeset viewer.