Adjust randomization
parent
b6830fa315
commit
d9bbef3831
|
@ -21,6 +21,9 @@ type Game struct {
|
|||
}
|
||||
|
||||
func (g *Game) Init() {
|
||||
ebiten.SetWindowSize(1280, 720)
|
||||
ebiten.SetWindowResizable(true)
|
||||
|
||||
rand.Seed(time.Now().UnixMilli())
|
||||
|
||||
g.Images = make(map[string]*ebiten.Image)
|
||||
|
@ -39,8 +42,6 @@ func (g *Game) Init() {
|
|||
}
|
||||
|
||||
g.ResetMap()
|
||||
|
||||
ebiten.SetWindowSize(640, 480)
|
||||
}
|
||||
|
||||
func (g *Game) ResetMap() {
|
||||
|
@ -48,7 +49,11 @@ func (g *Game) ResetMap() {
|
|||
w, h := ebiten.WindowSize()
|
||||
g.Map.Size(w/2/g.tileWidth, h/2/g.tileHeight)
|
||||
|
||||
g.cTiles = [][2]int{{rand.Intn(g.Map.w), rand.Intn(g.Map.h)}}
|
||||
g.cTiles = nil
|
||||
t := rand.Intn(8)
|
||||
for i := 0; i < t; i++ {
|
||||
g.cTiles = append(g.cTiles, [2]int{rand.Intn(g.Map.w), rand.Intn(g.Map.h)})
|
||||
}
|
||||
}
|
||||
|
||||
func (g *Game) getRandomTile(s []string) string {
|
||||
|
@ -104,5 +109,5 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||
|
||||
// Layout does normal layout stuff.
|
||||
func (g *Game) Layout(ow, oh int) (int, int) {
|
||||
return 320, 240
|
||||
return ow / 2, oh / 2
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue