refactor level, getting to tiles
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
package gamemap
|
||||
|
||||
import "lab.zaar.be/thefish/alchemyst-go/util"
|
||||
import (
|
||||
"container/ring"
|
||||
"lab.zaar.be/thefish/alchemyst-go/util"
|
||||
)
|
||||
import blt "lab.zaar.be/thefish/bearlibterminal"
|
||||
|
||||
type ColorHolder struct {
|
||||
@ -24,6 +27,28 @@ type Appearance struct {
|
||||
|
||||
var crng = util.NewRNG()
|
||||
|
||||
func NewColorComponentRing(colorValue uint8, minGlow, maxGlow, step int) *ring.Ring {
|
||||
q := make([]uint8, 0)
|
||||
color := int(colorValue)
|
||||
for color < maxGlow {
|
||||
q = append(q, uint8(color))
|
||||
color = crng.Range(0, step) + color
|
||||
}
|
||||
color = crng.Range(0, step + minGlow)
|
||||
for uint8(color) < colorValue {
|
||||
q = append(q, uint8(color))
|
||||
color = crng.Range(0, step + minGlow)
|
||||
}
|
||||
|
||||
r := ring.New(len(q))
|
||||
for _, v := range q {
|
||||
r.Next().Value = v
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
func colordance(colorValue uint8, minGlow, maxGlow, step int) uint8 {
|
||||
color := crng.Range(0, step) + int(colorValue)
|
||||
if color > maxGlow {
|
||||
|
Reference in New Issue
Block a user