Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ohj1htlokkihunter
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
sulasaal
ohj1htlokkihunter
Commits
1937b12d
Commit
1937b12d
authored
1 year ago
by
Sulasalmi Aleksi Sakari
Browse files
Options
Downloads
Patches
Plain Diff
lokit ei törmää toisiinsa
parent
306d147a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Harjoitustyö/Lokkihunter/Lokkihunter.cs
+27
-15
27 additions, 15 deletions
Harjoitustyö/Lokkihunter/Lokkihunter.cs
with
27 additions
and
15 deletions
Harjoitustyö/Lokkihunter/Lokkihunter.cs
+
27
−
15
View file @
1937b12d
...
...
@@ -18,7 +18,8 @@ public class Lokkihunter : PhysicsGame
Vector
nopeusOikea
=
new
Vector
(-
200
,
0
);
private
PhysicsObject
pekka
;
private
PhysicsObject
lokki
;
private
PhysicsObject
lokkiVasen
;
private
PhysicsObject
lokkiOikea
;
private
PhysicsObject
alaReuna
;
private
PhysicsObject
ylaReuna
;
...
...
@@ -92,31 +93,41 @@ public class Lokkihunter : PhysicsGame
private
void
LuoLokkiVasen
()
{
lokki
=
new
PhysicsObject
(
60.0
,
20.0
);
lokki
.
Shape
=
Shape
.
Rectangle
;
lokki
.
Hit
(
new
Vector
(
80
,
1
));
lokki
Vasen
=
new
PhysicsObject
(
60.0
,
20.0
);
lokki
Vasen
.
Shape
=
Shape
.
Rectangle
;
lokki
Vasen
.
Hit
(
new
Vector
(
80
,
1
));
double
x
=
-
400
;
lokki
.
X
=
x
;
lokki
Vasen
.
X
=
x
;
double
y
=
RandomGen
.
NextDouble
(
200
,
350
);
lokki
.
Y
=
y
;
lokki
Vasen
.
Y
=
y
;
Add
(
lokki
);
Add
(
lokki
Vasen
);
}
private
void
LuoLokkiOikea
()
{
lokki
=
new
PhysicsObject
(
60.0
,
20.0
);
lokki
.
Shape
=
Shape
.
Rectangle
;
lokki
.
Hit
(
new
Vector
(-
80
,
1
));
lokki
Oikea
=
new
PhysicsObject
(
60.0
,
20.0
);
lokki
Oikea
.
Shape
=
Shape
.
Rectangle
;
lokki
Oikea
.
Hit
(
new
Vector
(-
80
,
1
));
double
x
=
400
;
lokki
.
X
=
x
;
double
y
=
RandomGen
.
NextDouble
(
200
,
350
);
lokki
.
Y
=
y
;
lokkiOikea
.
X
=
x
;
double
y
;
do
{
y
=
RandomGen
.
NextDouble
(
200
,
350
);
}
while
(
Math
.
Abs
(
y
-
lokkiVasen
.
Y
)
<
40
);
lokkiOikea
.
Y
=
y
;
Add
(
lokki
);
Add
(
lokki
Oikea
);
}
// törmäys vasen ja oikea reuna
// ase
// pisteet
// kentät
// kommentit
}
\ No newline at end of file
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