Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
platformerpeli
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
garammtu
platformerpeli
Commits
cea1f15e
Commit
cea1f15e
authored
5 months ago
by
jalitat
Browse files
Options
Downloads
Patches
Plain Diff
lisäsin vaan bg
parent
fb6d4858
Branches
main
Tags
ht7
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pelikoodi/platformerPeli/platformerPeli/platformerPeli.cs
+14
-7
14 additions, 7 deletions
pelikoodi/platformerPeli/platformerPeli/platformerPeli.cs
with
14 additions
and
7 deletions
pelikoodi/platformerPeli/platformerPeli/platformerPeli.cs
+
14
−
7
View file @
cea1f15e
...
@@ -19,6 +19,7 @@ public class platformerPeli : PhysicsGame
...
@@ -19,6 +19,7 @@ public class platformerPeli : PhysicsGame
private
const
double
hyppyNopeus
=
500
;
private
const
double
hyppyNopeus
=
500
;
private
PlatformCharacter
pelaaja
;
private
PlatformCharacter
pelaaja
;
private
Image
pelaajankuva
=
LoadImage
(
"square.png"
);
private
Image
pelaajankuva
=
LoadImage
(
"square.png"
);
private
Image
background
=
LoadImage
(
"Illustration27.png"
);
/// <summary>
/// <summary>
...
@@ -31,11 +32,14 @@ public class platformerPeli : PhysicsGame
...
@@ -31,11 +32,14 @@ public class platformerPeli : PhysicsGame
public
override
void
Begin
()
public
override
void
Begin
()
{
{
Level
.
Width
=
Screen
.
Width
*
2
;
Level
.
Height
=
Screen
.
Height
*
1.5
;
SetWindowSize
(
1280
,
720
,
false
);
Level
.
Background
.
Image
=
background
;
Level
.
Background
.
FitToLevel
();
LuoKentta
();
Camera
.
Follow
(
pelaaja
);
Camera
.
ZoomToLevel
();
Camera
.
ZoomToLevel
();
Level
.
Background
.
Color
=
Color
.
SkyBlue
;
Level
.
CreateBorders
();
...
@@ -45,20 +49,23 @@ public class platformerPeli : PhysicsGame
...
@@ -45,20 +49,23 @@ public class platformerPeli : PhysicsGame
///Add(pelaaja);
///Add(pelaaja);
Gravity
=
new
Vector
(
0.0
,
-
1000
);
Gravity
=
new
Vector
(
0.0
,
-
1000
);
pelaaja
=
new
PlatformCharacter
(
40
,
8
0
);
pelaaja
=
new
PlatformCharacter
(
40
,
4
0
);
Vector
pelaajanPaikka
=
new
Vector
(
0
,
200
);
Vector
pelaajanPaikka
=
new
Vector
(
0
,
200
);
LisaaPelaaja
(
pelaajanPaikka
,
40
,
80
,
pelaaja
,
pelaajankuva
);
LisaaPelaaja
(
pelaajanPaikka
,
40
,
80
,
pelaaja
,
pelaajankuva
);
LisaaNappaimet
();
LisaaNappaimet
();
///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");
}
}
private
void
LuoKentta
()
{
Level
.
CreateBottomBorder
();
}
private
void
LisaaPelaaja
(
Vector
paikka
,
double
leveys
,
double
korkeus
,
PlatformCharacter
pelaaja
,
Image
kuva
)
private
void
LisaaPelaaja
(
Vector
paikka
,
double
leveys
,
double
korkeus
,
PlatformCharacter
pelaaja
,
Image
kuva
)
{
{
pelaaja
.
Position
=
paikka
;
pelaaja
.
Position
=
paikka
;
pelaaja
.
Mass
=
4.0
;
pelaaja
.
Image
=
kuva
;
pelaaja
.
Image
=
kuva
;
pelaaja
.
Restitution
=
0.0
;
pelaaja
.
Restitution
=
0.0
;
Add
(
pelaaja
);
Add
(
pelaaja
);
...
...
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