Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ohj1ht
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
pepihlaj
ohj1ht
Commits
93bd212a
Commit
93bd212a
authored
2 years ago
by
Pekka Pihlajamaa
Browse files
Options
Downloads
Patches
Plain Diff
Ohjaimet saatu haltuun
parent
29f59ca5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Hiko/Hiko/Hiko.cs
+11
-2
11 additions, 2 deletions
Hiko/Hiko/Hiko.cs
Hiko/Hiko/Hiko.csproj
+3
-0
3 additions, 0 deletions
Hiko/Hiko/Hiko.csproj
with
14 additions
and
2 deletions
Hiko/Hiko/Hiko.cs
+
11
−
2
View file @
93bd212a
...
@@ -12,6 +12,7 @@ namespace Hiko
...
@@ -12,6 +12,7 @@ namespace Hiko
{
{
PhysicsObject
pelaaja
;
PhysicsObject
pelaaja
;
GameObject
tahtain
;
public
override
void
Begin
()
public
override
void
Begin
()
{
{
// Kirjoita ohjelmakoodisi tähän
// Kirjoita ohjelmakoodisi tähän
...
@@ -21,6 +22,7 @@ namespace Hiko
...
@@ -21,6 +22,7 @@ namespace Hiko
LuoPelaaja
();
LuoPelaaja
();
Gravity
=
new
Vector
(
0.0
,
-
981.0
);
Gravity
=
new
Vector
(
0.0
,
-
981.0
);
LuoOhjaimet
();
LuoOhjaimet
();
LuoTahtain
();
PhoneBackButton
.
Listen
(
ConfirmExit
,
"Lopeta peli"
);
PhoneBackButton
.
Listen
(
ConfirmExit
,
"Lopeta peli"
);
Keyboard
.
Listen
(
Key
.
Escape
,
ButtonState
.
Pressed
,
ConfirmExit
,
"Lopeta peli"
);
Keyboard
.
Listen
(
Key
.
Escape
,
ButtonState
.
Pressed
,
ConfirmExit
,
"Lopeta peli"
);
}
}
...
@@ -34,6 +36,13 @@ namespace Hiko
...
@@ -34,6 +36,13 @@ namespace Hiko
Add
(
pelaaja
);
Add
(
pelaaja
);
return
pelaaja
;
return
pelaaja
;
}
}
GameObject
LuoTahtain
()
{
tahtain
=
new
GameObject
(
30.0
,
30.0
,
Shape
.
Circle
);
tahtain
.
Image
=
LoadImage
(
"tähtäinristikko"
);
Add
(
tahtain
);
return
tahtain
;
}
public
void
LuoOhjaimet
()
public
void
LuoOhjaimet
()
{
{
Keyboard
.
Listen
(
Key
.
Left
,
ButtonState
.
Down
,
LiikutaPelaajaa
,
null
,
new
Vector
(-
1000
,
0
));
Keyboard
.
Listen
(
Key
.
Left
,
ButtonState
.
Down
,
LiikutaPelaajaa
,
null
,
new
Vector
(-
1000
,
0
));
...
@@ -50,8 +59,8 @@ namespace Hiko
...
@@ -50,8 +59,8 @@ namespace Hiko
}
}
void
KuunteleLiiketta
()
void
KuunteleLiiketta
()
{
{
pelaaja
.
X
=
Mouse
.
PositionOnWorld
.
X
;
tahtain
.
X
=
Mouse
.
PositionOnWorld
.
X
;
pelaaja
.
Y
=
Mouse
.
PositionOnWorld
.
Y
;
tahtain
.
Y
=
Mouse
.
PositionOnWorld
.
Y
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Hiko/Hiko/Hiko.csproj
+
3
−
0
View file @
93bd212a
...
@@ -16,6 +16,9 @@
...
@@ -16,6 +16,9 @@
<None Update="Content\pääjehu.png">
<None Update="Content\pääjehu.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</None>
<None Update="Content\tähtäinristikko.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</ItemGroup>
</Project>
</Project>
...
...
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