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
jimsebna
ohj1ht
Commits
f6fffd4c
Commit
f6fffd4c
authored
1 day ago
by
Näivö Jimi Sebastian
Browse files
Options
Downloads
Plain Diff
border
parents
7961ffaa
348d09f6
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
SimulaattoriPeli/SimulaattoriPeli/SimulaattoriPeli.cs
+20
-48
20 additions, 48 deletions
SimulaattoriPeli/SimulaattoriPeli/SimulaattoriPeli.cs
with
20 additions
and
48 deletions
SimulaattoriPeli/SimulaattoriPeli/SimulaattoriPeli.cs
+
20
−
48
View file @
f6fffd4c
...
...
@@ -40,13 +40,12 @@ public class SimulaattoriPeli : PhysicsGame
Ohje
();
HahmotKuvakkeet
();
HahmoInfot
();
//Tiimi1Paikat();
}
private
void
Asetukset
()
// Pelin asetukset
{
Level
.
Background
.
Color
=
Color
.
Black
;
// Pelin taustan väri
Level
.
CreateBorders
(
1.0
,
false
);
// Pelin reunat
//
Level.CreateBorders(1.0,
true, Color.Green);
Camera
.
ZoomToLevel
();
// Kamera
IsFullScreen
=
true
;
// Koko näytön tila
}
...
...
@@ -68,7 +67,7 @@ public class SimulaattoriPeli : PhysicsGame
Areena
.
Image
=
LoadImage
(
"LavaArena.png"
);
// Kuva Areena:lle
Areena
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
// Kuvan terävyys (?)
Areena
.
Position
=
new
Vector
(
0
,
0
);
// Areenan sijainti
Add
(
Areena
);
// Luo Areenan peliin
Add
(
Areena
,
-
3
);
// Luo Areenan peliin
Hahmot
=
new
GameObject
(
450
,
1000
,
Shape
.
Rectangle
);
// Hahmojen alueen muoto ja koko
Hahmot
.
Color
=
Color
.
Pink
;
// Väri
...
...
@@ -230,47 +229,20 @@ public class SimulaattoriPeli : PhysicsGame
};
}
}
private
void
Tiimi1
Paika
t
()
//
L
uo
daan Tiimin 1 paikat taulukoiden avu
lla
private
Vector
Satunnainen
Paik
k
a
()
//
l
uo
ja palauttaa satunnaisen paikan annetulla aluee
lla
{
double
[]
xpiste
=
[
400
,
400
,
400
,-
400
,-
400
,-
400
];
double
[]
ypiste
=
[
0
,
200
,-
200
,
0
,
200
,-
200
];
int
n
=
xpiste
.
Length
;
GameObject
[]
Paikka
=
new
GameObject
[
n
];
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
if
(
i
<=
3
)
{
Paikka
[
i
]
=
new
GameObject
(
100
,
100
);
Paikka
[
i
].
Position
=
new
Vector
(
xpiste
[
i
],
ypiste
[
i
]);
Paikka
[
i
].
Shape
=
Shape
.
Circle
;
Paikka
[
i
].
Tag
=
"tiimin 1 paikat"
;
Paikka
[
i
].
Image
=
tiimikuva
;
Paikka
[
i
].
Image
.
Scaling
=
ImageScaling
.
Nearest
;
Add
(
Paikka
[
i
],
3
);
}
else
{
Paikka
[
i
]
=
new
GameObject
(
100
,
100
);
Paikka
[
i
].
Position
=
new
Vector
(
xpiste
[
i
],
ypiste
[
i
]);
Paikka
[
i
].
Shape
=
Shape
.
Circle
;
Paikka
[
i
].
Tag
=
"tiimin 2 paikat"
;
Paikka
[
i
].
Image
=
tiimikuva
;
Paikka
[
i
].
Image
.
Scaling
=
ImageScaling
.
Nearest
;
Add
(
Paikka
[
i
],
3
);
}
}
double
xpistesatunnainen
=
RandomGen
.
NextDouble
(-
450
,
450
);
// Luodaan satunnainen X-koordinaatti välillä -450 ja 450
double
ypistesatunnainen
=
RandomGen
.
NextDouble
(-
450
,
450
);
// Luodaan satunnainen Y-koordinaatti välillä -450 ja 450
return
new
Vector
(
xpistesatunnainen
,
ypistesatunnainen
);
// Palautetaan vektori, jossa satunnaiset koordinaatit
}
void
FysiikkaGiant
()
void
FysiikkaGiant
()
{
PhysicsObject
Giant
=
new
PhysicsObject
(
120.0
,
120.0
);
//Luodaan giant fysiikkaobjekti
Giant
.
Image
=
giantkuva
;
//Määritellään giant fysiikkaobjektille kuva
Giant
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
Giant
.
Position
=
new
Vector
(
50
,
0
);
Giant
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
//kuvan skaalausmenetelmä
Giant
.
Position
=
SatunnainenPaikka
(
);
Add
(
Giant
);
//Lisätään giant fysiikkaobjekti peliin
Giant
.
IgnoresGravity
=
true
;
Giant
.
Mass
=
1000
;
...
...
@@ -284,10 +256,10 @@ public class SimulaattoriPeli : PhysicsGame
void
FysiikkaWitch
()
{
PhysicsObject
witch
=
new
PhysicsObject
(
100.0
,
100.0
);
//Luodaan witch fysiikkaobjekti
witch
.
Image
=
witchkuva
;
//Määritellään witch fysiikkaobjektille kuva
witch
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
witch
.
Position
=
new
Vector
(-
50
,
0
);
PhysicsObject
witch
=
new
PhysicsObject
(
100.0
,
100.0
);
//Luodaan witch fysiikkaobjekti
witch
.
Image
=
witchkuva
;
//Määritellään witch fysiikkaobjektille kuva
witch
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
//kuvan skaalausmenetelmä
witch
.
Position
=
SatunnainenPaikka
();
// Määritellään satunnainen sijainti
Add
(
witch
);
//Lisätään witch fysiikkaobjekti peliin
}
/*
...
...
@@ -301,8 +273,8 @@ public class SimulaattoriPeli : PhysicsGame
{
PhysicsObject
healer
=
new
PhysicsObject
(
100.0
,
100.0
);
//Luodaan healer fysiikkaobjekti
healer
.
Image
=
healerkuva
;
//Määritellään healer fysiikkaobjektille kuva
healer
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
healer
.
Position
=
new
Vector
(
0
,
-
50
);
healer
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
//kuvan skaalausmenetelmä
healer
.
Position
=
SatunnainenPaikka
(
);
Add
(
healer
);
//Lisätään healer fysiikkaobjekti peliin
}
...
...
@@ -310,8 +282,8 @@ public class SimulaattoriPeli : PhysicsGame
{
PhysicsObject
archer
=
new
PhysicsObject
(
100.0
,
100.0
);
//Luodaan archer fysiikkaobjekti
archer
.
Image
=
archerkuva
;
//Määritellään archer fysiikkaobjektille kuva
archer
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
archer
.
Position
=
new
Vector
(
0
,
-
100
);
archer
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
//kuvan skaalausmenetelmä
archer
.
Position
=
SatunnainenPaikka
();
// Määritellään satunnainen sijainti
Add
(
archer
);
//Lisätään archer fysiikkaobjekti peliin
}
...
...
@@ -319,8 +291,8 @@ public class SimulaattoriPeli : PhysicsGame
{
PhysicsObject
samurai
=
new
PhysicsObject
(
100.0
,
100.0
);
//Luodaan samurai fysiikkaobjekti
samurai
.
Image
=
samuraikuva
;
//Määritellään samurai fysiikkaobjektille kuva
samurai
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
samurai
.
Position
=
new
Vector
(
0
,
100
);
samurai
.
Image
.
Scaling
=
ImageScaling
.
Nearest
;
//kuvan skaalausmenetelmä
samurai
.
Position
=
SatunnainenPaikka
();
// Määritellään satunnainen sijainti
Add
(
samurai
);
//Lisätään samurai fysiikkaobjekti peliin
}
...
...
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