mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
TileableValueNoise: it's working
Former-commit-id: 00c8c9490726fe8d7073044de7dd47482cc6788b Former-commit-id: 9eb4521219f1465bdb2fe924282e09f81035dd99
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user