diff --git a/Sammakkopeli/Sammakkopeli/Sammakkopeli.cs b/Sammakkopeli/Sammakkopeli/Sammakkopeli.cs index 5d4e94f91d6d5a8cc63db0e4e02afa0128413597..8e873a86a33ad5ceafbde56b000cf6912a5fed0a 100644 --- a/Sammakkopeli/Sammakkopeli/Sammakkopeli.cs +++ b/Sammakkopeli/Sammakkopeli/Sammakkopeli.cs @@ -16,7 +16,7 @@ namespace Sammakkopeli Timer hyppyLaskuri; Timer tarkastaLiike; - int sammakkoTippuuKertoja = 8; + int sammakkoTippuuKertoja; bool onkoHypannut = false; double nopeusX = 0.0; @@ -38,13 +38,14 @@ namespace Sammakkopeli Keyboard.Listen(Key.Right, ButtonState.Down, AsetaNopeus, null, 1); Keyboard.Listen(Key.Right, ButtonState.Released, PysaytaSammakko, null); - Keyboard.Listen(Key.Space, ButtonState.Pressed, SammakkoHyppaa, null); + Keyboard.Listen(Key.Space, ButtonState.Pressed, SammakkoHyppaa, null, 10); } void AsetaNopeus(int suunta) { nopeusX = suunta * 600.0; + SammakkoHyppaa(6); } @@ -61,6 +62,8 @@ namespace Sammakkopeli Level.CreateBottomBorder(0.0, true); + Camera.Follow(sammakko); + hyppyLaskuri = new Timer(); hyppyLaskuri.Interval = 0.05; hyppyLaskuri.Timeout += SammakkoTippuu; @@ -79,6 +82,7 @@ namespace Sammakkopeli sammakko.X = x; sammakko.Y = y; sammakko.Color = Color.Green; + sammakko.CanRotate = false; Add(sammakko); AddCollisionHandler(sammakko, KasitteleSammakonTormays); @@ -93,12 +97,13 @@ namespace Sammakkopeli } - public void SammakkoHyppaa() + public void SammakkoHyppaa(int korkeus) { if (onkoHypannut == false) { onkoHypannut = true; - hyppyLaskuri.Start(16); + sammakkoTippuuKertoja = korkeus; + hyppyLaskuri.Start(20); } } @@ -106,10 +111,9 @@ namespace Sammakkopeli void SammakkoTippuu() { sammakkoTippuuKertoja -= 1; - if (sammakkoTippuuKertoja < -7) + if (sammakkoTippuuKertoja < -9) { - nopeusY = -800.0; - sammakkoTippuuKertoja = 8; + nopeusY = -1000.0; return; } nopeusY = sammakkoTippuuKertoja * 100;