TileableValueNoise: it's working

Former-commit-id: 00c8c9490726fe8d7073044de7dd47482cc6788b
Former-commit-id: 9eb4521219f1465bdb2fe924282e09f81035dd99
This commit is contained in:
Song Minjae
2016-11-02 22:17:12 +09:00
parent cddbdeab7d
commit 5a366a84da
2 changed files with 38 additions and 26 deletions

View File

@@ -34,7 +34,7 @@ class StateTestingSandbox : BasicGameState() {
val bolt = LightingBolt(lightning_start, lightning_end, 50)
val noiseGen = TileableValueNoise(12, 0.5f, 128)
val noiseGen = TileableValueNoise(6, 0.4f, 128)
override fun init(container: GameContainer?, game: StateBasedGame?) {
noiseGen.generate(seed)
@@ -61,13 +61,13 @@ class StateTestingSandbox : BasicGameState() {
val xoff = 10f
val yoff = 300f
for (x in noiseGen.width downTo 1) {
for (x in 0..noiseGen.width - 1) {
val pStart = noiseGen[x] * amp + yoff
val pEnd = noiseGen[x - 1] * amp + yoff
val pEnd = noiseGen[x + 1] * amp + yoff
val step = 6
g.drawLine((noiseGen.width - x) * step + xoff, pStart,
(noiseGen.width - x +1) * step + xoff, pEnd)
g.drawLine(x * step + xoff, pStart,
(x+1) * step + xoff, pEnd)
}
g.color = Color.red