Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
A ket torony
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
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
sabvente
A ket torony
Commits
9b579b16
Commit
9b579b16
authored
11 years ago
by
Sabvente
Browse files
Options
Downloads
Patches
Plain Diff
hangok megállítása kilépésnél; Tower range fix #2
parent
aaaca59d
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/engine/Engine.java
+12
-0
12 additions, 0 deletions
src/engine/Engine.java
src/view/Sounds.java
+11
-0
11 additions, 0 deletions
src/view/Sounds.java
src/world/Tower.java
+8
-3
8 additions, 3 deletions
src/world/Tower.java
with
31 additions
and
3 deletions
src/engine/Engine.java
+
12
−
0
View file @
9b579b16
...
...
@@ -4,6 +4,8 @@ import interfaces.ITickable;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
...
...
@@ -81,6 +83,16 @@ public class Engine
gameWindow
.
setSize
(
1000
,
750
);
gameWindow
.
setResizable
(
false
);
gameWindow
.
setContentPane
(
new
GamePanel
(
world
));
gameWindow
.
addWindowListener
(
new
WindowAdapter
()
{
@Override
public
void
windowClosing
(
WindowEvent
e
)
{
isGameRunning
=
false
;
Sounds
.
StopAllSound
();
}
});
isGameRunning
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
src/view/Sounds.java
+
11
−
0
View file @
9b579b16
...
...
@@ -2,6 +2,7 @@ package view;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
javax.sound.sampled.AudioInputStream
;
import
javax.sound.sampled.AudioSystem
;
...
...
@@ -10,6 +11,7 @@ import javax.sound.sampled.LineUnavailableException;
import
javax.sound.sampled.UnsupportedAudioFileException
;
public
class
Sounds
{
private
static
ArrayList
<
Clip
>
clips
=
new
ArrayList
<
Clip
>();
public
static
void
LoopSound
(
String
file
)
{
AudioInputStream
aStream
=
null
;
try
{
...
...
@@ -44,8 +46,17 @@ public class Sounds {
clip
.
open
(
aStream
);
clip
.
setFramePosition
(
0
);
clip
.
start
();
clips
.
add
(
clip
);
}
catch
(
LineUnavailableException
|
IOException
e1
)
{
e1
.
printStackTrace
();
}
}
public
static
void
StopAllSound
()
{
for
(
Clip
c
:
clips
)
{
c
.
stop
();
}
clips
.
clear
();
}
}
This diff is collapsed.
Click to expand it.
src/world/Tower.java
+
8
−
3
View file @
9b579b16
...
...
@@ -76,9 +76,15 @@ public class Tower extends Placeable implements ITickable, IEnemyObserver,
for
(
Field
field
:
visibleFields
)
{
if
(
field
==
null
)
continue
;
newVisible
.
addAll
(
field
.
getNeighbours
());
for
(
Field
neigh
:
field
.
getNeighbours
())
{
if
(!
newVisible
.
contains
(
neigh
))
newVisible
.
add
(
neigh
);
}
}
for
(
Field
neigh
:
newVisible
)
{
if
(!
visibleFields
.
contains
(
neigh
))
visibleFields
.
add
(
neigh
);
}
visibleFields
.
addAll
(
newVisible
);
getVisibleFields
(
visibleFields
,
iterations
-
1
);
}
...
...
@@ -86,7 +92,6 @@ public class Tower extends Placeable implements ITickable, IEnemyObserver,
enemiesInRange
.
clear
();
ArrayList
<
Field
>
visibleFields
=
new
ArrayList
<
Field
>();
visibleFields
.
add
(
field
);
getVisibleFields
(
visibleFields
,
range
);
if
(
fogDescends
)
getVisibleFields
(
visibleFields
,
range
-
1
);
...
...
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