Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ohj1ht matopeli
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
kopperp
ohj1ht matopeli
Commits
32720de8
Commit
32720de8
authored
1 year ago
by
Kopperoinen Paulus
Browse files
Options
Downloads
Patches
Plain Diff
Jos mato kuolee, peli alkaa automaattisesti alusta
parent
f420330f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Matopeli/Matopeli/Matopeli.cs
+12
-10
12 additions, 10 deletions
Matopeli/Matopeli/Matopeli.cs
with
12 additions
and
10 deletions
Matopeli/Matopeli/Matopeli.cs
+
12
−
10
View file @
32720de8
...
@@ -40,7 +40,6 @@ public class matopeli : PhysicsGame
...
@@ -40,7 +40,6 @@ public class matopeli : PhysicsGame
private
Objektit
Omena
;
private
Objektit
Omena
;
private
Objektit
MatoMuu
;
private
Objektit
MatoMuu
;
private
Timer
aikalaskuri
;
public
IntMeter
pistelaskuri
;
public
IntMeter
pistelaskuri
;
public
List
<
Vector
>
MatoSijainti
=
new
List
<
Vector
>();
public
List
<
Vector
>
MatoSijainti
=
new
List
<
Vector
>();
...
@@ -64,19 +63,17 @@ public class matopeli : PhysicsGame
...
@@ -64,19 +63,17 @@ public class matopeli : PhysicsGame
private
bool
GameOver
;
private
bool
GameOver
;
private
bool
OmenaKentalla
=
true
;
private
bool
OmenaKentalla
;
public
override
void
Begin
()
public
override
void
Begin
()
{
{
Keyboard
.
Listen
(
Key
.
Escape
,
ButtonState
.
Pressed
,
ConfirmExit
,
"Lopeta peli"
);
ClearAll
();
AloitaUusiPeli
();
AloitaUusiPeli
();
}
}
public
void
AloitaUusiPeli
()
public
void
AloitaUusiPeli
()
{
{
MatoKeho
.
Clear
();
MatoSijainti
.
Clear
();
ClearAll
();
Asetukset
();
Asetukset
();
TileMap
tiles
=
TileMap
.
FromStringArray
(
tasonkuva
);
TileMap
tiles
=
TileMap
.
FromStringArray
(
tasonkuva
);
tiles
[
'#'
]
=
LuoSeina
;
tiles
[
'#'
]
=
LuoSeina
;
...
@@ -123,11 +120,12 @@ public class matopeli : PhysicsGame
...
@@ -123,11 +120,12 @@ public class matopeli : PhysicsGame
Nopeus
=
0.1
;
Nopeus
=
0.1
;
MatoLiikkunut
=
true
;
MatoLiikkunut
=
true
;
GameOver
=
false
;
GameOver
=
false
;
OmenaKentalla
=
true
;
}
}
private
void
MatoKuolee
()
private
void
MatoKuolee
()
{
{
GameOver
=
true
;
AloitaUusiPeli
()
;
}
}
private
PhysicsObject
LuoMato
()
private
PhysicsObject
LuoMato
()
{
{
...
@@ -304,8 +302,12 @@ public class matopeli : PhysicsGame
...
@@ -304,8 +302,12 @@ public class matopeli : PhysicsGame
{
{
Timer
aikalaskuri
=
new
Timer
();
Timer
aikalaskuri
=
new
Timer
();
aikalaskuri
.
Interval
=
Nopeus
;
aikalaskuri
.
Interval
=
Nopeus
;
aikalaskuri
.
Start
();
if
(
GameOver
==
false
)
aikalaskuri
.
Timeout
+=
PaivitaKentta
;
{
aikalaskuri
.
Start
();
aikalaskuri
.
Timeout
+=
PaivitaKentta
;
}
}
}
/// <summary>
/// <summary>
...
...
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