Changeset 8218 for 2016/30/JoonasL


Ignore:
Timestamp:
2016-07-28 14:58:01 (7 years ago)
Author:
jolehto
Message:
 
Location:
2016/30/JoonasL/Arrow
Files:
4 added
10 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • 2016/30/JoonasL/Arrow/Arrow/Arrow/Arrow.cs

    r8174 r8218  
    99public class Arrow : PhysicsGame 
    1010{ 
    11     private PhysicsObject player; 
    12  
    13     private PhysicsObject[] percents = new PhysicsObject[4]; 
    14  
    15     private ExplosionSystem noteEffect = new ExplosionSystem(LoadImage("note"), 250); 
    16     private ExplosionSystem coinEffect = new ExplosionSystem(LoadImage("coin"), 250); 
     11    private PhysicsObject player_1, player_2, ball_1, ball_2; 
     12 
     13    private PhysicsObject[] obstacles = new PhysicsObject[4]; 
     14 
     15    private ExplosionSystem orangeEffect = new ExplosionSystem(LoadImage("particle_1"), 250); 
     16    private ExplosionSystem redEffect = new ExplosionSystem(LoadImage("particle_2"), 250); 
    1717 
    1818    private Label[] menuLabels = new Label[4]; 
    1919 
    20     private bool down = true, dead = true; 
    21  
    22     private float MOVEMENT_SPEED = 0, multiplier = 1000, difficulty = 1; 
    23     private List<Vector> points = new List<Vector>(); 
    24     private Image redPercent, greenPercent; 
    25  
    26     private float yearsLeft = 100; 
    27     private Label labelYearsLeft; 
     20    private bool down_1 = true, down_2 = true, dead_1 = true, dead_2 = true, singlePlayer, launched = false; 
     21 
     22    private float MOVEMENT_SPEED = 0, multiplier = 1000, difficulty = 1, seconds_1 = 0, seconds_2 = 0; 
     23    private List<Vector> points_1 = new List<Vector>(), points_2 = new List<Vector>(); 
     24 
     25    private Label label_1 = new Label("0s"), label_2 = new Label("0s"); 
    2826 
    2927    public override void Begin() 
    3028    { 
    3129        Window.Fullscreen = true; 
    32         SmoothTextures = false; 
    3330 
    3431        Level.Background.Image = LoadImage("background"); 
    3532 
    3633        Timer.SingleShot(0.5, Menu_First); 
    37  
    38         redPercent = LoadImage("percent"); 
    39         greenPercent = LoadImage("percent_1"); 
    4034    } 
    4135 
     
    4337    { 
    4438        ClearAll(); 
     39 
     40        Level.Background.Color = Color.Black; 
     41 
     42        dead_1 = true; 
     43        dead_2 = true; 
    4544 
    4645        Level.Background.Image = LoadImage("background"); 
     
    4948        Mouse.ListenMovement(1.0, OnMenuMouseMove, null); 
    5049 
    51         menuLabels[0] = new Label("Aloita peli"); 
    52         menuLabels[0].X = Screen.Left * 0.89; 
     50        menuLabels[0] = new Label("Yksinpeli"); 
     51        menuLabels[0].X = Screen.Left * 0.9; 
    5352        menuLabels[0].Y = Screen.Top * 0.93; 
    5453        menuLabels[0].TextScale = new Vector(1.5, 1.5); 
    55         Mouse.ListenOn(menuLabels[0], MouseButton.Left, ButtonState.Pressed, Menu_Second, null); 
     54        Mouse.ListenOn(menuLabels[0], MouseButton.Left, ButtonState.Pressed, Menu_Second, null, true); 
    5655        Add(menuLabels[0]); 
    5756 
    58         menuLabels[1] = new Label("Lopeta Peli"); 
    59         menuLabels[1].X = Screen.Left * 0.885; 
     57        menuLabels[1] = new Label("Moninpeli"); 
     58        menuLabels[1].X = Screen.Left * 0.895; 
    6059        menuLabels[1].Y = Screen.Top * 0.845; 
    6160        menuLabels[1].TextScale = new Vector(1.5, 1.5); 
    62         Mouse.ListenOn(menuLabels[1], MouseButton.Left, ButtonState.Pressed, Exit, null); 
     61        Mouse.ListenOn(menuLabels[1], MouseButton.Left, ButtonState.Pressed, Menu_Second, null, false); 
    6362        Add(menuLabels[1]); 
    64  
    65         menuLabels[2] = null; 
     63    
     64        menuLabels[2] = new Label("Lopeta Peli"); 
     65        menuLabels[2].X = Screen.Left * 0.885; 
     66        menuLabels[2].Y = Screen.Top * 0.76; 
     67        menuLabels[2].TextScale = new Vector(1.5, 1.5); 
     68        Mouse.ListenOn(menuLabels[2], MouseButton.Left, ButtonState.Pressed, Exit, null); 
     69        Add(menuLabels[2]); 
     70 
    6671        menuLabels[3] = null; 
    6772    } 
    6873 
    69     private void Menu_Second () 
     74    private void Menu_Second (bool b) 
    7075    { 
    7176        ClearAll(); 
     77 
     78        singlePlayer = b; 
     79 
     80        Level.Background.Color = Color.Black; 
    7281 
    7382        Level.Background.Image = LoadImage("background"); 
     
    111120        ClearAll(); 
    112121 
     122        Mouse.IsCursorVisible = false; 
     123 
     124        points_1 = new List<Vector>(); 
     125        points_2 = new List<Vector>(); 
     126        points_1.Add(new Vector(Screen.Left * 1.5, 0)); 
     127        points_2.Add(new Vector(Screen.Left * 1.5, 0)); 
     128 
     129        ball_1 = new PhysicsObject(50, 50, Shape.Circle); 
     130        ball_1.Color = Color.Black; 
     131        ball_2 = new PhysicsObject(50, 50, Shape.Circle); 
     132        ball_1.IsVisible = false; 
     133        ball_2.IsVisible = false; 
     134 
     135        Add(ball_1); 
     136        Add(ball_2); 
     137 
    113138        difficulty = i; 
    114139 
     
    117142        SetListeners(); 
    118143 
    119         dead = false; 
    120  
    121         noteEffect.MinRotationSpeed = 20; 
    122         noteEffect.MaxRotationSpeed = 20; 
    123         coinEffect.MinRotationSpeed = 20; 
    124         coinEffect.MaxRotationSpeed = 20; 
    125  
    126         Add(noteEffect); 
    127         Add(coinEffect); 
     144        dead_1 = false; 
     145 
     146        if (!singlePlayer) dead_2 = false; 
     147 
     148        orangeEffect.MinVelocity = 1000; 
     149        orangeEffect.MaxVelocity = 1000; 
     150        orangeEffect.MinScale = 10; 
     151        orangeEffect.MaxScale = 10; 
     152        redEffect.MinVelocity = 1000; 
     153        redEffect.MaxVelocity = 1000; 
     154        redEffect.MinScale = 10; 
     155        redEffect.MaxScale = 10; 
     156 
     157        Add(orangeEffect); 
     158        Add(redEffect); 
     159 
     160        label_1.Y = Screen.Top - label_1.Width * 2; 
     161        label_1.TextScale = new Vector(1.25, 1.25); 
     162        label_1.TextColor = Color.Red; 
     163 
     164        seconds_1 = 0; 
     165        seconds_2 = 0; 
     166 
     167        Add(label_1); 
    128168 
    129169        CreatePercent(0); 
     
    132172        CreatePercent(3); 
    133173 
    134         labelYearsLeft = new Label(); 
    135         labelYearsLeft.X = -880; 
    136         labelYearsLeft.Y = 500; 
    137         Add(labelYearsLeft); 
    138  
    139         player = new PhysicsObject(50, 50, Shape.Triangle); 
    140         player.Image = LoadImage("arrow"); 
    141         player.Angle = Angle.FromDegrees(325); 
    142         Add(player); 
    143  
    144         AddCollisionHandler(player, "Percent", Die); 
     174        player_1 = new PhysicsObject(50, 50, Shape.Triangle); 
     175        player_1.Image = LoadImage("arrow"); 
     176        player_1.Angle = Angle.FromDegrees(325); 
     177        Add(player_1); 
     178 
     179        if (!singlePlayer) 
     180        { 
     181            label_2.Y = Screen.Top - label_1.Width * 2 - label_1.Height * 2; 
     182            label_2.TextScale = new Vector(1.25, 1.25); 
     183            label_2.TextColor = Color.Blue; 
     184            Add(label_2); 
     185 
     186            player_2 = new PhysicsObject(50, 50, Shape.Triangle); 
     187            player_2.Image = LoadImage("arrow"); 
     188            player_2.Angle = Angle.FromDegrees(325); 
     189            Add(player_2); 
     190 
     191            AddCollisionHandler(player_2, "Percent", Die_2); 
     192        } 
     193 
     194        AddCollisionHandler(player_1, "Percent", Die_1); 
    145195    } 
    146196 
    147197    private void SetListeners() 
    148198    { 
    149         Mouse.Listen(MouseButton.Left, ButtonState.Down, MoveUp, null); 
    150         Mouse.Listen(MouseButton.Left, ButtonState.Up, MoveDown, null); 
    151         Keyboard.Listen(Key.R, ButtonState.Pressed, Start, null, difficulty); 
    152         Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, ""); 
     199        Mouse.Listen(MouseButton.Left, ButtonState.Down, MoveUp_1, null); 
     200        Mouse.Listen(MouseButton.Left, ButtonState.Up, MoveDown_1, null); 
     201        Keyboard.Listen(Key.R, ButtonState.Pressed, Restart, null); 
     202        Keyboard.Listen(Key.Escape, ButtonState.Pressed, Menu_First, null); 
     203 
     204        if (!singlePlayer) 
     205        { 
     206            Keyboard.Listen(Key.Space, ButtonState.Down, MoveUp_2, null); 
     207            Keyboard.Listen(Key.Space, ButtonState.Up, MoveDown_2, null); 
     208        } 
     209    } 
     210 
     211    private void Restart () 
     212    { 
     213        player_1.IsVisible = true; 
     214        player_1.Y = 0; 
     215        points_1 = new List<Vector>(); 
     216        points_1.Add(new Vector(Screen.Left * 1.5, 0)); 
     217        dead_1 = false; 
     218 
     219        if (!singlePlayer) 
     220        { 
     221            player_2.IsVisible = true; 
     222            player_2.Y = 0; 
     223            points_2 = new List<Vector>(); 
     224            points_2.Add(new Vector(Screen.Left * 1.5, 0)); 
     225            dead_2 = false; 
     226        } 
     227 
     228        multiplier = 1000; 
     229 
     230        RandomPercentPosition(obstacles[0], 0); 
     231        RandomPercentPosition(obstacles[1], 1); 
     232        RandomPercentPosition(obstacles[2], 2); 
     233        RandomPercentPosition(obstacles[3], 3); 
     234 
     235        seconds_1 = 0; 
     236        seconds_2 = 0; 
    153237    } 
    154238 
    155239    protected override void Paint(Canvas canvas) 
    156240    { 
    157         if (!down) { canvas.BrushColor = new Color(0, 255, 0, 255); } else { canvas.BrushColor = Color.Red; } 
    158  
    159         for (int i = 0; i < points.Count; i++) 
    160         { 
    161             if (i + 1 < points.Count) 
    162             { 
    163                 if (points[i].X >= Level.Left * 2 && points[i + 1].X >= Level.Left * 2) 
     241        if (Level.Background.Color == Color.Black) return; 
     242 
     243        canvas.BrushColor = new Color(255, 0, 0, 255); 
     244         
     245        for (int i = 0; i < points_1.Count; i++) 
     246        { 
     247            if (i + 1 < points_1.Count) 
     248            { 
     249                if (points_1[i].X >= Screen.Left * 1.5 || points_1[i + 1].X >= Screen.Left * 1.5) 
    164250                { 
    165                     canvas.DrawLine(points[i] - new Vector(0, 1), points[i + 1] - new Vector(0, 1)); 
    166                     canvas.DrawLine(points[i] - new Vector(0, 2), points[i + 1] - new Vector(0, 2)); 
    167                     canvas.DrawLine(points[i] - new Vector(0, 3), points[i + 1] - new Vector(0, 3)); 
    168                     canvas.DrawLine(points[i] - new Vector(0, 4), points[i + 1] - new Vector(0, 4)); 
    169                     canvas.DrawLine(points[i] - new Vector(0, 5), points[i + 1] - new Vector(0, 5)); 
    170                     canvas.DrawLine(points[i], points[i + 1]); 
    171                     canvas.DrawLine(points[i] + new Vector(0, 1), points[i + 1] + new Vector(0, 1)); 
    172                     canvas.DrawLine(points[i] + new Vector(0, 2), points[i + 1] + new Vector(0, 2)); 
    173                     canvas.DrawLine(points[i] + new Vector(0, 3), points[i + 1] + new Vector(0, 3)); 
    174                     canvas.DrawLine(points[i] + new Vector(0, 4), points[i + 1] + new Vector(0, 3)); 
    175                     canvas.DrawLine(points[i] + new Vector(0, 5), points[i + 1] + new Vector(0, 3)); 
     251                    canvas.DrawLine(points_1[i] - new Vector(0, 1), points_1[i + 1] - new Vector(0, 1)); 
     252                    canvas.DrawLine(points_1[i] - new Vector(0, 2), points_1[i + 1] - new Vector(0, 2)); 
     253                    canvas.DrawLine(points_1[i] - new Vector(0, 3), points_1[i + 1] - new Vector(0, 3)); 
     254                    canvas.DrawLine(points_1[i] - new Vector(0, 4), points_1[i + 1] - new Vector(0, 4)); 
     255                    canvas.DrawLine(points_1[i] - new Vector(0, 5), points_1[i + 1] - new Vector(0, 5)); 
     256                    canvas.DrawLine(points_1[i], points_1[i + 1]); 
     257                    canvas.DrawLine(points_1[i] + new Vector(0, 1), points_1[i + 1] + new Vector(0, 1)); 
     258                    canvas.DrawLine(points_1[i] + new Vector(0, 2), points_1[i + 1] + new Vector(0, 2)); 
     259                    canvas.DrawLine(points_1[i] + new Vector(0, 3), points_1[i + 1] + new Vector(0, 3)); 
     260                    canvas.DrawLine(points_1[i] + new Vector(0, 4), points_1[i + 1] + new Vector(0, 3)); 
     261                    canvas.DrawLine(points_1[i] + new Vector(0, 5), points_1[i + 1] + new Vector(0, 3)); 
    176262                } 
    177263                else 
    178264                { 
    179                     points.RemoveAt(i); 
    180                     points.RemoveAt(i + 1); 
     265                    try 
     266                    { 
     267                        points_1.RemoveAt(i); 
     268                        points_1.RemoveAt(i + 1); 
     269                    } 
     270                    catch (Exception) 
     271                    {} 
    181272                } 
    182273            } 
    183274        } 
    184275 
     276        if (!singlePlayer) 
     277        { 
     278            canvas.BrushColor = new Color(0, 0, 255, 255); 
     279 
     280            for (int i = 0; i < points_2.Count; i++) 
     281            { 
     282                if (i + 1 < points_2.Count) 
     283                { 
     284                    if (points_2[i].X >= Screen.Left * 1.5 || points_2[i + 1].X >= Screen.Left * 1.5) 
     285                    { 
     286                        canvas.DrawLine(points_2[i] - new Vector(0, 1), points_2[i + 1] - new Vector(0, 1)); 
     287                        canvas.DrawLine(points_2[i] - new Vector(0, 2), points_2[i + 1] - new Vector(0, 2)); 
     288                        canvas.DrawLine(points_2[i] - new Vector(0, 3), points_2[i + 1] - new Vector(0, 3)); 
     289                        canvas.DrawLine(points_2[i] - new Vector(0, 4), points_2[i + 1] - new Vector(0, 4)); 
     290                        canvas.DrawLine(points_2[i] - new Vector(0, 5), points_2[i + 1] - new Vector(0, 5)); 
     291                        canvas.DrawLine(points_2[i], points_2[i + 1]); 
     292                        canvas.DrawLine(points_2[i] + new Vector(0, 1), points_2[i + 1] + new Vector(0, 1)); 
     293                        canvas.DrawLine(points_2[i] + new Vector(0, 2), points_2[i + 1] + new Vector(0, 2)); 
     294                        canvas.DrawLine(points_2[i] + new Vector(0, 3), points_2[i + 1] + new Vector(0, 3)); 
     295                        canvas.DrawLine(points_2[i] + new Vector(0, 4), points_2[i + 1] + new Vector(0, 3)); 
     296                        canvas.DrawLine(points_2[i] + new Vector(0, 5), points_2[i + 1] + new Vector(0, 3)); 
     297                    } 
     298                    else 
     299                    { 
     300                        try 
     301                        { 
     302                            points_2.RemoveAt(i); 
     303                            points_2.RemoveAt(i + 1); 
     304                        } 
     305                        catch (Exception) 
     306                        {} 
     307                    } 
     308                } 
     309            } 
     310        } 
     311 
    185312        base.Paint(canvas); 
    186313    } 
     
    190317        base.Update(time); 
    191318 
    192         if (!dead) 
    193         {      
     319        if (!dead_1) 
     320        { 
     321            seconds_1 += (float)time.SinceLastUpdate.TotalSeconds; 
     322            label_1.Text = (int) seconds_1 + "s"; 
     323 
     324            if (down_1) 
     325            { 
     326                player_1.Y -= MOVEMENT_SPEED; 
     327            } 
     328            else 
     329            { 
     330                player_1.Y += MOVEMENT_SPEED; 
     331            } 
     332 
     333            if (player_1.Y <= Screen.Bottom) 
     334            { 
     335                Die_1(null, null); 
     336            } 
     337            else if (player_1.Y >= Screen.Top) 
     338            { 
     339                Die_1(null, null); 
     340            } 
     341        } 
     342 
     343        if (!singlePlayer && !dead_2) 
     344        { 
     345            seconds_2 += (float)time.SinceLastUpdate.TotalSeconds; 
     346            label_2.Text = (int) seconds_2 + "s"; 
     347 
     348            if (down_2) 
     349            { 
     350                player_2.Y -= MOVEMENT_SPEED; 
     351            } 
     352            else 
     353            { 
     354                player_2.Y += MOVEMENT_SPEED; 
     355            } 
     356 
     357            if (player_2.Y <= Screen.Bottom) 
     358            { 
     359                Die_2 (null, null); 
     360            } 
     361            else if (player_2.Y >= Screen.Top) 
     362            { 
     363                Die_2(null, null); 
     364            } 
     365        } 
     366 
     367        if (!dead_1 || !dead_2) 
     368        { 
    194369            MOVEMENT_SPEED = multiplier * (float)time.SinceLastUpdate.TotalSeconds * difficulty; 
    195             multiplier += (float) time.SinceLastUpdate.TotalMilliseconds / 60; 
    196  
    197             if (down) 
    198             { 
    199                 player.Y -= MOVEMENT_SPEED; 
    200                 yearsLeft -= 0.1f; 
     370            multiplier += (float)time.SinceLastUpdate.TotalMilliseconds / 60; 
     371 
     372            for (int i = 0; i < 4; i++) 
     373            { 
     374                obstacles[i].X -= MOVEMENT_SPEED; 
     375 
     376                if (obstacles[i].X < Screen.Left * 1.2) 
     377                { 
     378                    RandomPercentPosition(obstacles[i], i); 
     379                    obstacles[i].Color = new Color(RandomGen.NextInt(0, 225), RandomGen.NextInt(0, 225), RandomGen.NextInt(0, 225)); 
     380                } 
     381            } 
     382 
     383            for (int i = 0; i < points_1.Count; i++) { points_1[i] -= new Vector(MOVEMENT_SPEED, 0); } 
     384 
     385            if (!singlePlayer) 
     386            { 
     387                for (int i = 0; i < points_2.Count; i++) { points_2[i] -= new Vector(MOVEMENT_SPEED, 0); } 
     388            } 
     389 
     390            double value = 0.75; 
     391 
     392            if (!launched) 
     393            { 
     394                if (value == 0.75) 
     395                { 
     396                    launched = true; 
     397                    ball_1.X = 4000; 
     398                    ball_1.IsVisible = true; 
     399                    ball_2.IsVisible = true; 
     400                } 
    201401            } 
    202402            else 
    203403            { 
    204                 player.Y += MOVEMENT_SPEED; 
    205                 yearsLeft -= 0.01f; 
    206             } 
    207  
    208             labelYearsLeft.Text = (int) yearsLeft + " vuotta jäljellä ennen maailman konkurssia"; 
    209  
    210             labelYearsLeft.Left = Screen.Left * 0.965; 
    211  
    212             for (int i = 0; i < 4; i++) 
    213             { 
    214                 percents[i].X -= MOVEMENT_SPEED; 
    215  
    216                 if (percents[i].X < Screen.Left * 1.2) 
    217                 { 
    218                     RandomPercentPosition(percents[i], i); 
    219                     percents[i].Image = greenOrRed(); 
    220                 } 
    221             } 
    222  
    223             for (int i = 0; i < points.Count; i++) { points[i] -= new Vector(MOVEMENT_SPEED, 0); } 
    224         } 
    225    } 
    226  
    227      
     404                Vector direction = ball_1.Position - player_1.Position; 
     405                float length = (float) Math.Sqrt(Math.Pow(direction.X, 2) + Math.Pow(direction.Y, 2)); 
     406                direction.X /= length; 
     407                direction.Y /= length; 
     408                ball_1.Position -= direction * 10; 
     409            } 
     410        } 
     411    } 
     412 
    228413   private void RandomPercentPosition (PhysicsObject physicsObject, int index) 
    229414   { 
     
    248433   } 
    249434 
    250    private Image greenOrRed () 
     435   private void Die_1 (PhysicsObject a, PhysicsObject percent) 
    251436   { 
    252         double value = RandomGen.NextDouble(0, 1); 
    253  
    254         if (value < 0.5) 
    255         { 
    256             return redPercent; 
    257         } 
    258         else 
    259         { 
    260             return greenPercent; 
    261         } 
     437        if (dead_1) { return; } 
     438 
     439        player_1.IsVisible = false; 
     440        dead_1 = true; 
     441        orangeEffect.AddEffect(player_1.Position + new Vector(RandomGen.NextDouble(-100, 100), RandomGen.NextDouble(-100, 100)), 25); 
     442        redEffect.AddEffect(player_1.Position + new Vector(RandomGen.NextDouble(-100, 100), RandomGen.NextDouble(-100, 100)), 25); 
     443    } 
     444 
     445    private void Die_2(PhysicsObject a, PhysicsObject percent) 
     446    { 
     447        if (dead_2) { return; } 
     448 
     449        player_2.IsVisible = false; 
     450        dead_2 = true; 
     451        orangeEffect.AddEffect(player_2.Position + new Vector(RandomGen.NextDouble(-100, 100), RandomGen.NextDouble(-100, 100)), 25); 
     452        redEffect.AddEffect(player_2.Position + new Vector(RandomGen.NextDouble(-100, 100), RandomGen.NextDouble(-100, 100)), 25); 
     453    } 
     454 
     455    private void MoveUp_1() 
     456   { 
     457        if (dead_1) { return; } 
     458 
     459        points_1.Add(player_1.Position - new Vector(5, 0)); 
     460        player_1.Angle = Angle.FromDegrees(45); 
     461        down_1 = false; 
    262462   } 
    263463 
    264    private void Die (PhysicsObject a, PhysicsObject percent) 
    265    { 
    266         if (percent.Image.Equals(greenPercent)) 
    267         { 
    268             yearsLeft += 5; 
    269         } 
    270         else 
    271         { 
    272             player.Destroy(); 
    273             dead = true; 
    274             noteEffect.AddEffect(player.Position + new Vector(RandomGen.NextDouble(-100, 100), RandomGen.NextDouble(-100, 100)), 25); 
    275             coinEffect.AddEffect(player.Position + new Vector(RandomGen.NextDouble(-100, 100), RandomGen.NextDouble(-100, 100)), 25); 
    276         } 
    277    } 
    278  
    279    private void MoveUp() 
    280    { 
    281         if (dead) { return; } 
    282  
    283         points.Add(player.Position - new Vector(10, 0)); 
    284         player.Angle = Angle.FromDegrees(45); 
    285         down = false; 
    286    } 
    287  
    288     private void MoveDown() 
    289     { 
    290         if (dead) { return; } 
    291  
    292         points.Add(player.Position - new Vector(10, 0)); 
    293         player.Angle = Angle.FromDegrees(325); 
    294         down = true; 
     464    private void MoveDown_1() 
     465    { 
     466        if (dead_1) { return; } 
     467 
     468        points_1.Add(player_1.Position - new Vector(5, 0)); 
     469        player_1.Angle = Angle.FromDegrees(325); 
     470        down_1 = true; 
     471    } 
     472 
     473    private void MoveUp_2() 
     474    { 
     475        if (dead_2) { return; } 
     476 
     477        points_2.Add(player_2.Position - new Vector(5, 0)); 
     478        player_2.Angle = Angle.FromDegrees(45); 
     479        down_2 = false; 
     480    } 
     481 
     482    private void MoveDown_2() 
     483    { 
     484        if (dead_2) { return; } 
     485 
     486        points_2.Add(player_2.Position - new Vector(5, 0)); 
     487        player_2.Angle = Angle.FromDegrees(325); 
     488        down_2 = true; 
    295489    } 
    296490 
     
    298492    { 
    299493        PhysicsObject physicsObject = new PhysicsObject(100, 100); 
    300         physicsObject.Image = greenOrRed(); 
     494        physicsObject.Color = new Color(RandomGen.NextInt(0, 225), RandomGen.NextInt(0, 225), RandomGen.NextInt(0, 225)); 
    301495        physicsObject.Tag = "Percent"; 
    302         percents[index] = physicsObject; 
     496        obstacles[index] = physicsObject; 
    303497        RandomPercentPosition(physicsObject, index); 
    304498        Add(physicsObject); 
     
    312506            if (label != null) 
    313507            { 
    314                 if (Mouse.IsCursorOn(label)) 
    315                 { 
    316                     label.TextColor = Color.Red; 
    317                 } 
    318                 else 
    319                 { 
    320                     label.TextColor = Color.Black; 
    321                 } 
     508                if (Mouse.IsCursorOn(label)) { label.TextColor = Color.Red; } 
     509                else { label.TextColor = Color.Black;} 
    322510            } 
    323511        } 
  • 2016/30/JoonasL/Arrow/Arrow/Arrow/Arrow.csproj.Debug.cachefile

    r8174 r8218  
    1 Content\percent.xnb 
    2 Content\percent_1.xnb 
    3 Content\ruutuja.xnb 
    41Content\note.xnb 
    52Content\coin.xnb 
    63Content\background.xnb 
    74Content\arrow.xnb 
     5Content\particle_2.xnb 
     6Content\particle_1.xnb 
  • 2016/30/JoonasL/Arrow/Arrow/Arrow/obj/x86/Debug/Arrow.csproj.FileListAbsolute.txt

    r8174 r8218  
    77C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\obj\x86\Debug\Arrow.exe 
    88C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\obj\x86\Debug\Arrow.pdb 
    9 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\percent.xnb 
    10 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\percent_1.xnb 
    11 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\ruutuja.xnb 
    12 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\note.xnb 
    13 C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\coin.xnb 
    149C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\background.xnb 
    1510C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\arrow.xnb 
     11C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\particle_2.xnb 
     12C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\particle_1.xnb 
  • 2016/30/JoonasL/Arrow/Arrow/Arrow/obj/x86/Debug/ContentPipeline-{2DF1C49F-6BF7-4BA9-9FE6-D0E53C97361E}.xml

    r8174 r8218  
    22<XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline"> 
    33  <Asset Type="Pipeline:BuildItemCollection"> 
    4     <Item> 
    5       <Source>percent.png</Source> 
    6       <Name>percent</Name> 
    7       <Importer>TextureImporter</Importer> 
    8       <Processor>TextureProcessor</Processor> 
    9       <Options>None</Options> 
    10       <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\percent.xnb</Output> 
    11       <Time>2016-07-26T14:49:51.4914241+03:00</Time> 
    12     </Item> 
    13     <Item> 
    14       <Source>percent_1.png</Source> 
    15       <Name>percent_1</Name> 
    16       <Importer>TextureImporter</Importer> 
    17       <Processor>TextureProcessor</Processor> 
    18       <Options>None</Options> 
    19       <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\percent_1.xnb</Output> 
    20       <Time>2016-07-26T14:52:12.5064241+03:00</Time> 
    21     </Item> 
    22     <Item> 
    23       <Source>ruutuja.jpg</Source> 
    24       <Name>ruutuja</Name> 
    25       <Importer>TextureImporter</Importer> 
    26       <Processor>TextureProcessor</Processor> 
    27       <Options>None</Options> 
    28       <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\ruutuja.xnb</Output> 
    29       <Time>2016-07-27T10:13:12.2122876+03:00</Time> 
    30     </Item> 
    31     <Item> 
    32       <Source>note.jpg</Source> 
    33       <Name>note</Name> 
    34       <Importer>TextureImporter</Importer> 
    35       <Processor>TextureProcessor</Processor> 
    36       <Options>None</Options> 
    37       <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\note.xnb</Output> 
    38       <Time>2016-07-27T10:29:57.9114414+03:00</Time> 
    39     </Item> 
    40     <Item> 
    41       <Source>coin.png</Source> 
    42       <Name>coin</Name> 
    43       <Importer>TextureImporter</Importer> 
    44       <Processor>TextureProcessor</Processor> 
    45       <Options>None</Options> 
    46       <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\coin.xnb</Output> 
    47       <Time>2016-07-27T10:30:39.3061092+03:00</Time> 
    48     </Item> 
    494    <Item> 
    505      <Source>background.png</Source> 
     
    6419      <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\arrow.xnb</Output> 
    6520      <Time>2016-07-27T14:39:40.043614+03:00</Time> 
     21    </Item> 
     22    <Item> 
     23      <Source>particle_2.png</Source> 
     24      <Name>particle_2</Name> 
     25      <Importer>TextureImporter</Importer> 
     26      <Processor>TextureProcessor</Processor> 
     27      <Options>None</Options> 
     28      <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\particle_2.xnb</Output> 
     29      <Time>2016-07-28T13:15:52.8800486+03:00</Time> 
     30    </Item> 
     31    <Item> 
     32      <Source>particle_1.png</Source> 
     33      <Name>particle_1</Name> 
     34      <Importer>TextureImporter</Importer> 
     35      <Processor>TextureProcessor</Processor> 
     36      <Options>None</Options> 
     37      <Output>C:\MyTemp\JoonasL\Arrow\Arrow\Arrow\bin\x86\Debug\Content\particle_1.xnb</Output> 
     38      <Time>2016-07-28T13:16:20.4270486+03:00</Time> 
    6639    </Item> 
    6740    <BuildSuccessful>true</BuildSuccessful> 
  • 2016/30/JoonasL/Arrow/Arrow/Arrow/obj/x86/Debug/cachefile-{2DF1C49F-6BF7-4BA9-9FE6-D0E53C97361E}-targetpath.txt

    r8174 r8218  
    1 Content\percent.xnb 
    2 Content\percent_1.xnb 
    3 Content\ruutuja.xnb 
    4 Content\note.xnb 
    5 Content\coin.xnb 
    61Content\background.xnb 
    72Content\arrow.xnb 
     3Content\particle_2.xnb 
     4Content\particle_1.xnb 
  • 2016/30/JoonasL/Arrow/Arrow/ArrowContent/ArrowContent.contentproj

    r8174 r8218  
    4646  </ItemGroup> 
    4747  <ItemGroup> 
    48     <Compile Include="percent.png"> 
    49       <Name>percent</Name> 
    50       <Importer>TextureImporter</Importer> 
    51       <Processor>TextureProcessor</Processor> 
    52     </Compile> 
    53   </ItemGroup> 
    54   <ItemGroup> 
    55     <Compile Include="percent_1.png"> 
    56       <Name>percent_1</Name> 
    57       <Importer>TextureImporter</Importer> 
    58       <Processor>TextureProcessor</Processor> 
    59     </Compile> 
    60   </ItemGroup> 
    61   <ItemGroup> 
    62     <Compile Include="ruutuja.jpg"> 
    63       <Name>ruutuja</Name> 
    64       <Importer>TextureImporter</Importer> 
    65       <Processor>TextureProcessor</Processor> 
    66     </Compile> 
    67   </ItemGroup> 
    68   <ItemGroup> 
    69     <Compile Include="note.jpg"> 
    70       <Name>note</Name> 
    71       <Importer>TextureImporter</Importer> 
    72       <Processor>TextureProcessor</Processor> 
    73     </Compile> 
    74   </ItemGroup> 
    75   <ItemGroup> 
    76     <Compile Include="coin.png"> 
    77       <Name>coin</Name> 
    78       <Importer>TextureImporter</Importer> 
    79       <Processor>TextureProcessor</Processor> 
    80     </Compile> 
    81   </ItemGroup> 
    82   <ItemGroup> 
    8348    <Compile Include="background.png"> 
    8449      <Name>background</Name> 
     
    9459    </Compile> 
    9560  </ItemGroup> 
     61  <ItemGroup> 
     62    <Compile Include="particle_2.png"> 
     63      <Name>particle_2</Name> 
     64      <Importer>TextureImporter</Importer> 
     65      <Processor>TextureProcessor</Processor> 
     66    </Compile> 
     67  </ItemGroup> 
     68  <ItemGroup> 
     69    <Compile Include="particle_1.png"> 
     70      <Name>particle_1</Name> 
     71      <Importer>TextureImporter</Importer> 
     72      <Processor>TextureProcessor</Processor> 
     73    </Compile> 
     74  </ItemGroup> 
    9675  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    9776  <!--  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.