Skip to content
Snippets Groups Projects
Commit d3e44e1d authored by Snellman Väinö Juhani's avatar Snellman Väinö Juhani
Browse files

paranneltiin pelihahmon liikkuvuutta enemmän

parent a5d3044c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment