Changeset 7213 for 2016


Ignore:
Timestamp:
2016-06-09 12:22:24 (7 years ago)
Author:
sieerinn
Message:

Fontteja lisätty

Location:
2016/23/ohjaajat/Punasininen/Punasininen
Files:
3 added
2 edited

Legend:

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

    r7212 r7213  
    1313    private const double JUMPSPEED = 1250; 
    1414    private const int TILE_SIZE = 60; 
     15    private const int MATCH_LENGTH = 30; 
    1516 
    1617    private Player blue; 
     
    2324    private Image blueGlow = LoadImage("blueglow"); 
    2425 
     26    Font largeFont = LoadFont("SymtextLarge"); 
     27    Font smallFont = LoadFont("SymtextSmall"); 
     28 
    2529    Color blueColor = Color.FromHexCode("FF1D65CF"); 
    2630    Color redColor = Color.FromHexCode("FABE1A"); 
     
    3741    { 
    3842        shader = new Shader(GraphicsDevice, Content, Camera); 
     43        SmoothTextures = false; 
    3944 
    4045        CreateLevel(); 
     
    5863        ColorTileMap map = ColorTileMap.FromLevelAsset("dungeon1"); 
    5964        map.SetTileMethod(Color.Black, AddPlatform); 
    60         //map.SetTileMethod(Color.FromHexCode("#FF0026FF"), delegate (Vector paikka, double leveys, double korkeus) { blue = CreatePlayer(paikka, leveys, korkeus, bluepic, blueColor); }); 
    61         //map.SetTileMethod(Color.FromHexCode("#FF0026FF"), delegate(Vector paikka, double leveys, double korkeus) { blue = CreatePlayer(paikka, leveys, korkeus, bluepic, blueColor);}); 
    6265        map.SetTileMethod(Color.FromHexCode("#FF0026FF"), delegate(Vector paikka, double leveys, double korkeus) { blue = CreatePlayer(paikka, leveys, korkeus, blueColor, blueWalkImages, bluePistolpic);}); 
    63  
    6466        map.SetTileMethod(Color.FromHexCode("FFD800"), CreateWeaponCrate); 
    65  
    66         //map.SetTileMethod(Color.Red, delegate (Vector paikka, double leveys, double korkeus) { red = CreatePlayer(paikka, leveys, korkeus, redpic, redColor); }); 
    67         //map.SetTileMethod(Color.Red, delegate(Vector paikka, double leveys, double korkeus) { red = CreatePlayer(paikka, leveys, korkeus, redpic, redColor); }); 
    6867        map.SetTileMethod(Color.Red, delegate(Vector paikka, double leveys, double korkeus) { red = CreatePlayer(paikka, leveys, korkeus, redColor, orangeWalkImages, orangePistolpic); }); 
    6968        map.Execute(TILE_SIZE, TILE_SIZE); 
     
    8786        Add(percentageBar); 
    8887 
    89         matchTimer = new DoubleMeter(30); 
    90  
    91         var timeLabel = new Label(); 
    92         timeLabel.Y = Window.Height / 2 - 100; 
    93         timeLabel.BindTo(matchTimer); 
    94         timeLabel.TextColor = blueColor; 
    95         timeLabel.DoubleFormatString = "{0}"; 
    96         timeLabel.TextScale *= 3; 
    97         Add(timeLabel); 
     88        matchTimer = new DoubleMeter(MATCH_LENGTH); 
     89        matchTimer.LowerLimit += () => 
     90        { 
     91            Win(percentageTracker.Value >= 50 ? red : blue); 
     92            var restart = new Timer() { Interval = 5, IgnorePause = true }; 
     93            restart.Timeout += () => { ClearAll(); Begin(); Pause(); }; 
     94            restart.Start(); 
     95        }; 
     96 
     97        Func<double, double, Color, Label> createLabel; 
     98        createLabel = (double x, double y, Color color) => 
     99        { 
     100            var label = new Label(); 
     101            label.Font = largeFont; 
     102            label.X = x; 
     103            label.Y = y; 
     104            label.BindTo(matchTimer); 
     105            label.TextColor = color; 
     106            label.DoubleFormatString = "{0}"; 
     107            Add(label); 
     108            return label; 
     109        }; 
     110 
     111        var timeLabelDark = createLabel(5, Window.Height / 2 - 100 - 5, Color.Black); 
     112        var timeLabel = createLabel(0, Window.Height / 2 - 100, blueColor); 
    98113 
    99114        var timer = new Timer(); 
     
    136151        player.Weapon = new AssaultRifle(leveys * 1.5, korkeus * 1.5) 
    137152        { 
    138             FireRate = 1.5, 
     153            FireRate = 3, 
    139154            AttackSound = null, 
    140155            MaxAmmoLifetime = TimeSpan.FromSeconds(8), 
     
    168183    void BulletHitsSomething(PhysicsObject bullet, PhysicsObject target) 
    169184    { 
    170         if (target.Tag == "platform") 
     185        if (target.Tag.ToString() == "platform") 
    171186        { 
    172187            // TODO bullet must know its owner 
     
    191206    { 
    192207        Pause(); 
    193         //Haluaisin tehdä tähän jonkinlaisen hauskan ponnahdusefektin jossain vaiheessa. Sellaisen napakan zoomin ja sitten boing. Hurdur. 
    194         Camera.ZoomTo(player.Left, player.Bottom, player.Right, player.Top + 100); 
    195  
     208 
     209        // Haluaisin tehdä tähän jonkinlaisen hauskan ponnahdusefektin jossain vaiheessa. Sellaisen napakan zoomin ja sitten boing. Hurdur. 
     210         
     211        // Tekstille musta tausta, jotta sen näkee lukea. 
     212        Label announcementDark = new Label("Kiva homma hei") 
     213        { 
     214            Font = largeFont,  // Vaihtoehtona smallFont myös 
     215            TextColor = Color.Black 
     216        }; 
     217        Add(announcementDark); 
     218 
     219        // Voittoteksti. 
    196220        Label announcement = new Label("Kiva homma hei") 
    197221        { 
    198             TextColor = player.Color, 
    199             Position = Camera.WorldToScreen(player.Position + new Vector(0, 40)), 
    200             TextScale = new Vector(2, 2) 
     222            Font = largeFont,  // Vaihtoehtona smallFont myös 
     223            TextColor = player.Color 
    201224        }; 
    202225        Add(announcement); 
     226 
     227 
     228        double targetZoomFactor = 1.5; 
     229        var zoomTimer = new Timer(); 
     230        zoomTimer.Interval = 0.01; 
     231        zoomTimer.Timeout += () => 
     232        { 
     233            var targetPos = player.Position; 
     234            Camera.Position += (targetPos - Camera.Position) * 0.02; 
     235            Camera.ZoomFactor += (targetZoomFactor - Camera.ZoomFactor) * 0.01; 
     236            announcement.Position = Camera.WorldToScreen(player.Position + new Vector(0, 80)); 
     237            announcementDark.Position = announcement.Position + new Vector(5, -5); 
     238        }; 
     239        zoomTimer.IgnorePause = true; 
     240        zoomTimer.Start(); 
     241 
    203242 
    204243    } 
  • 2016/23/ohjaajat/Punasininen/Punasininen/PunasininenContent/PunasininenContent.contentproj

    r7209 r7213  
    373373    </Compile> 
    374374  </ItemGroup> 
     375  <ItemGroup> 
     376    <None Include="Symtext.ttf"> 
     377      <Name>Symtext</Name> 
     378    </None> 
     379  </ItemGroup> 
     380  <ItemGroup> 
     381    <Compile Include="SymtextLarge.spritefont"> 
     382      <Name>SymtextLarge</Name> 
     383      <Importer>FontDescriptionImporter</Importer> 
     384      <Processor>FontDescriptionProcessor</Processor> 
     385    </Compile> 
     386  </ItemGroup> 
     387  <ItemGroup> 
     388    <Compile Include="SymtextSmall.spritefont"> 
     389      <Name>SymtextSmall</Name> 
     390      <Importer>FontDescriptionImporter</Importer> 
     391      <Processor>FontDescriptionProcessor</Processor> 
     392    </Compile> 
     393  </ItemGroup> 
    375394  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    376395  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
Note: See TracChangeset for help on using the changeset viewer.