Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Sammakkopeli
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
snelvjxz
Sammakkopeli
Commits
d3e44e1d
Commit
d3e44e1d
authored
2 years ago
by
Snellman Väinö Juhani
Browse files
Options
Downloads
Patches
Plain Diff
paranneltiin pelihahmon liikkuvuutta enemmän
parent
a5d3044c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sammakkopeli/Sammakkopeli/Sammakkopeli.cs
+11
-7
11 additions, 7 deletions
Sammakkopeli/Sammakkopeli/Sammakkopeli.cs
with
11 additions
and
7 deletions
Sammakkopeli/Sammakkopeli/Sammakkopeli.cs
+
11
−
7
View file @
d3e44e1d
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment