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
tslahtin
ohj1ht
Commits
a603fcab
Commit
a603fcab
authored
1 year ago
by
Ranta Veeti
Browse files
Options
Downloads
Patches
Plain Diff
ekoja tekemisiä peliin
parent
422e8dd8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
HT/HT/HT.cs
+37
-1
37 additions, 1 deletion
HT/HT/HT.cs
HT/HT/Ohjelma.cs
+1
-1
1 addition, 1 deletion
HT/HT/Ohjelma.cs
with
38 additions
and
2 deletions
HT/HT/HT.cs
+
37
−
1
View file @
a603fcab
using
System
;
using
System.Collections.Generic
;
using
System.Drawing
;
using
Jypeli
;
using
Jypeli.Assets
;
using
Jypeli.Controls
;
using
Jypeli.Widgets
;
using
Color
=
Jypeli
.
Color
;
namespace
HT
;
public
class
H
T
:
PhysicsGame
public
class
H
t
:
PhysicsGame
{
PhysicsObject
broidi
;
public
override
void
Begin
()
{
// Kirjoita ohjelmakoodisi tähän
LuoKentta
();
AsetaOhjaimet
();
void
LuoKentta
()
{
broidi
=
new
PhysicsObject
(
50
,
50
);
broidi
.
Shape
=
Shape
.
Rectangle
;
broidi
.
Color
=
Color
.
Red
;
Add
(
broidi
);
}
void
AsetaOhjaimet
()
{
Keyboard
.
Listen
(
Key
.
W
,
ButtonState
.
Down
,
Liikuttaa
,
"Pelaaja 1: Liikuta Broidia ylös"
,
new
Vector
(
0.0
,
300.0
));
Keyboard
.
Listen
(
Key
.
W
,
ButtonState
.
Released
,
Liikuttaa
,
null
,
Vector
.
Zero
);
Keyboard
.
Listen
(
Key
.
S
,
ButtonState
.
Down
,
Liikuttaa
,
"Pelaaja 1: Liikuta Broidia alas"
,
new
Vector
(
0.0
,
-
300.0
));
Keyboard
.
Listen
(
Key
.
S
,
ButtonState
.
Released
,
Liikuttaa
,
null
,
Vector
.
Zero
);
Keyboard
.
Listen
(
Key
.
D
,
ButtonState
.
Down
,
Liikuttaa
,
"pelaaja 2: Liikuta Broidia ylös"
,
new
Vector
(
300.0
,
0.0
));
Keyboard
.
Listen
(
Key
.
D
,
ButtonState
.
Released
,
Liikuttaa
,
null
,
Vector
.
Zero
);
Keyboard
.
Listen
(
Key
.
A
,
ButtonState
.
Down
,
Liikuttaa
,
"Pelaaja 2: Liikuta Broidia alas"
,
new
Vector
(-
300
,
0.0
));
Keyboard
.
Listen
(
Key
.
A
,
ButtonState
.
Released
,
Liikuttaa
,
null
,
Vector
.
Zero
);
}
void
Liikuttaa
(
Vector
nopeus
)
{
broidi
.
Velocity
=
nopeus
;
}
Level
.
Background
.
Color
=
new
Color
(
189
,
183
,
107
);
PhoneBackButton
.
Listen
(
ConfirmExit
,
"Lopeta peli"
);
Keyboard
.
Listen
(
Key
.
Escape
,
ButtonState
.
Pressed
,
ConfirmExit
,
"Lopeta peli"
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
HT/HT/Ohjelma.cs
+
1
−
1
View file @
a603fcab
...
...
@@ -19,7 +19,7 @@ namespace HT
[
STAThread
]
static
void
Main
()
{
using
var
game
=
new
H
T
();
using
var
game
=
new
H
t
();
game
.
Run
();
}
}
...
...
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