Ignore:
Timestamp:
2016-06-08 11:33:01 (3 years ago)
Author:
sieerinn
Message:

Hohtoefekti tehty ilman varjostinohjelmia

File:
1 edited

Legend:

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

    r7203 r7204  
    11using System; 
    22using System.Collections.Generic; 
     3using System.Linq; 
    34using Jypeli; 
    45using Jypeli.Assets; 
     
    1415 
    1516    private Player blue; 
    16     private Player red;  
     17    private Player red; 
     18    private Image[] orangeTileImages = LoadImages("bluetile\\bluetile", 12); 
     19    private Image[] blueTileImages; 
     20    private Image orangeGlow = LoadImage("orangeglow"); 
     21    private Image blueGlow = LoadImage("blueglow"); 
     22 
    1723    private Image bluepic; 
    1824    private Image redpic; 
     
    2632    public override void Begin() 
    2733    { 
     34 
    2835        IsMouseVisible = true; // <- voi ottaa pois 
    2936        shader = new Shader(GraphicsDevice, Content, Camera); 
     
    3239        CreateLevel(); 
    3340        AddControls(); 
     41    } 
     42 
     43    private static Image[] LoadImages(string prefix, int numberOfImages) 
     44    { 
     45        var images = new Image[numberOfImages]; 
     46        for (int i = 1; i <= numberOfImages; i++) 
     47        { 
     48            //images[i-1] = LoadImage(string.Format("{0}{1:0000}", prefix, numberOfImages)); 
     49            images[i-1] = LoadImage($"{prefix}{numberOfImages.ToString().PadLeft(4, '0')}"); 
     50        } 
     51        return images; 
    3452    } 
    3553 
     
    136154    void ColorTile(PhysicsObject player, PhysicsObject platform) 
    137155    { 
     156        GameObject glow = platform.Objects.FirstOrDefault(); 
     157        if (glow == null) 
     158        { 
     159            glow = new GameObject(TILE_SIZE * 7, TILE_SIZE * 7); 
     160            platform.Add(glow); 
     161        } 
     162        glow.Image = player.Color == Color.Blue? blueGlow : orangeGlow; 
    138163        platform.Color = player.Color; 
    139164 
Note: See TracChangeset for help on using the changeset viewer.