Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
esimerkit
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
tie
ohj1
2023s
esimerkit
Commits
d1b69153
Commit
d1b69153
authored
1 year ago
by
Vesa Lappalainen
Browse files
Options
Downloads
Patches
Plain Diff
mailan kaantaminen
parent
8774ef4c
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
luennot/live14/AngryLego/AngryLego.cs
+17
-1
17 additions, 1 deletion
luennot/live14/AngryLego/AngryLego.cs
with
17 additions
and
1 deletion
luennot/live14/AngryLego/AngryLego.cs
+
17
−
1
View file @
d1b69153
...
...
@@ -38,6 +38,8 @@ public class AngryLego : PhysicsGame
private
static
readonly
int
tileWidth
=
800
/
lines
[
0
].
Length
;
private
static
readonly
int
tileHeight
=
480
/
lines
.
Length
;
private
PhysicsObject
maila
;
// LuoMaila, KaannaMaila
public
override
void
Begin
()
{
...
...
@@ -58,6 +60,10 @@ public class AngryLego : PhysicsGame
Level
.
CreateBorders
();
Camera
.
ZoomToLevel
();
Keyboard
.
Listen
(
Key
.
F1
,
ButtonState
.
Pressed
,
ShowControlHelp
,
"Show help"
);
Keyboard
.
Listen
(
Key
.
Up
,
ButtonState
.
Pressed
,
KaannaMailaa
,
"Move up"
,
5.0
);
Keyboard
.
Listen
(
Key
.
Down
,
ButtonState
.
Pressed
,
KaannaMailaa
,
"Move down"
,
-
5.0
);
PhoneBackButton
.
Listen
(
ConfirmExit
,
"Lopeta peli"
);
Keyboard
.
Listen
(
Key
.
Escape
,
ButtonState
.
Pressed
,
ConfirmExit
,
"Lopeta peli"
);
...
...
@@ -78,6 +84,16 @@ public class AngryLego : PhysicsGame
}
/// <summary>
/// Käännetään mailaa
/// </summary>
/// <param name="kulma">millä kulmalla käännetään</param>
private
void
KaannaMailaa
(
double
kulma
)
{
maila
.
Angle
+=
Angle
.
FromDegrees
(
kulma
);
}
/// <summary>
/// Luodaan isompi yläseinäelementti
/// </summary>
...
...
@@ -113,7 +129,7 @@ public class AngryLego : PhysicsGame
/// </summary>
private
void
LuoMaila
(
Vector
paikka
,
double
leveys
,
double
korkeus
,
Color
vari
)
{
PhysicsObject
maila
=
PhysicsObject
.
CreateStaticObject
(
leveys
*
6
,
korkeus
);
maila
=
PhysicsObject
.
CreateStaticObject
(
leveys
*
6
,
korkeus
);
maila
.
Position
=
paikka
;
maila
.
Color
=
vari
;
maila
.
Image
=
LoadImage
(
"maila3"
);
...
...
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