Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
killer_sokoban
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Schulcz Ferenc
killer_sokoban
Commits
099a6ccd
Commit
099a6ccd
authored
7 years ago
by
zalavari
Browse files
Options
Downloads
Patches
Plain Diff
kill függvények implementálása
parent
bccd1838
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/killer_sokoban/Crate.java
+1
-10
1 addition, 10 deletions
src/killer_sokoban/Crate.java
src/killer_sokoban/Worker.java
+2
-12
2 additions, 12 deletions
src/killer_sokoban/Worker.java
with
3 additions
and
22 deletions
src/killer_sokoban/Crate.java
+
1
−
10
View file @
099a6ccd
package
killer_sokoban
;
import
java.util.ArrayList
;
public
class
Crate
extends
Moveable
{
...
...
@@ -12,38 +11,30 @@ public class Crate extends Moveable {
* A láda elveszik, és nem vesz részt a további játékban.
*/
public
void
kill
()
{
Main
.
deleteCrate
(
this
);
}
/**Ha a láda célmezőre került, akkor kerül meghívásra ez a függvény.
* @param w a munkás, aki a tolást indította
*/
public
void
stepOnTarget
(
Worker
w
)
{
w
.
incrementPoint
();
isOnTarget
=
true
;
}
/**Ha a láda a célmezőről lekerült, akkor kerül meghívásra ez a függvény.
* @param w a munkás, aki a tolást indította
*/
public
void
stepOffTarget
(
Worker
w
)
{
w
.
decrementPoint
();
isOnTarget
=
false
;
}
/** Ha a láda kapcsolóra került, akkor kerül meghívásra ez a függvény.
* @param s kapcsolót tartalmazó mező
*/
public
void
onSwitch
(
SwitchField
s
)
{
s
.
turnOn
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/killer_sokoban/Worker.java
+
2
−
12
View file @
099a6ccd
...
...
@@ -31,7 +31,6 @@ public class Worker extends Moveable {
*/
public
boolean
step
(
Direction
toward
)
{
activeForce
=
force
;
boolean
result
=
myField
.
stepMe
(
toward
,
this
);
...
...
@@ -42,27 +41,22 @@ public class Worker extends Moveable {
* Pontot ad a játékosnak.
*/
public
void
incrementPoint
()
{
points
++;
}
/**
* Pontot vesz el a játékostól.
*/
public
void
decrementPoint
()
{
points
--;
}
/**
* A munkás meghal, és nem vesz részt a további játékban.
*/
public
void
kill
()
{
force
=
0
;
alive
=
false
;
}
/**
...
...
@@ -70,9 +64,7 @@ public class Worker extends Moveable {
*/
protected
boolean
squeez
()
{
kill
();
return
true
;
}
...
...
@@ -80,9 +72,7 @@ public class Worker extends Moveable {
* A munkás eldönti, hogy az újabb ládát még el tudja-e tolni
*/
public
boolean
decrementForce
(
double
by
)
{
activeForce
-=
by
;
return
(
activeForce
>=
0.0
);
}
...
...
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