Added panning with keyboard.
Changed D for digging into H for harvesting.
This commit is contained in:
parent
c27d43e323
commit
76ac685cbb
@ -23,13 +23,13 @@ In Botanim you play the role of botanist and your goal is to cultivate flowers i
|
||||
Flowers can only grow (well) in certain climates based on two properties: humidity and temperature. Watch out for existing vegetation to get an idea how humid the land is and check the appearance of the tile to see how hot it is. When well placed your planted flower will spread soon but an odd choice might kill your flower almost instantly. So choose carefully. When the flower spread significantly you can dig up flowers again to collect more money.
|
||||
|
||||
**Controls:**
|
||||
- D: Selects shovel
|
||||
- H: Selects shovel
|
||||
- R: Selects research
|
||||
- Spacebar: pauses game
|
||||
- 1: runs game at normal speed
|
||||
- 2: runs game extra fast
|
||||
- Mouse wheel or plus/minus: zooms landscape
|
||||
- CTRL + left mouse button or middle mouse button: pans landscape
|
||||
- W, A, S, D keys or CTRL + left mouse button or middle mouse button: pans landscape
|
||||
|
||||
Have fun playing!
|
||||
|
||||
|
@ -163,7 +163,7 @@ func (c *GameControls) Handle(ctx *Context, event sdl.Event) bool {
|
||||
c.game.Run()
|
||||
case sdl.K_2:
|
||||
c.game.RunFast()
|
||||
case sdl.K_d:
|
||||
case sdl.K_h:
|
||||
c.game.SelectShovel()
|
||||
case sdl.K_r:
|
||||
c.dialogs.ShowResearch(ctx)
|
||||
|
4
intro.go
4
intro.go
@ -12,13 +12,13 @@ func (i *Intro) Init(ctx *Context) error {
|
||||
"In Botanim you play the role of botanist and your goal is to cultivate flowers in an open landscape.\n\n" +
|
||||
"Flowers can only grow (well) in certain climates based on two properties: humidity and temperature. Watch out for existing vegetation to get an idea how humid the land is and check the appearance of the tile to see how hot it is. When well placed your planted flower will spread soon but an odd choice might kill your flower almost instantly. So choose carefully. When the flower spread significantly you can dig up flowers again to collect more money.\n\n" +
|
||||
"Controls:\n" +
|
||||
" - D: Selects shovel\n" +
|
||||
" - H: Selects shovel\n" +
|
||||
" - R: Selects research\n" +
|
||||
" - Spacebar: pauses game\n" +
|
||||
" - 1: runs game at normal speed\n" +
|
||||
" - 2: runs game extra fast\n" +
|
||||
" - Mouse wheel or plus/minus: zooms landscape\n" +
|
||||
" - CTRL + left mouse button or middle mouse button: pans landscape\n" +
|
||||
" - W, A, S, D keys or CTRL + left mouse button or middle mouse button: pans landscape\n" +
|
||||
"\n" +
|
||||
"Have fun playing!"
|
||||
i.SetContent(&i.welcome)
|
||||
|
@ -101,6 +101,20 @@ func (p *projection) visibleTiles(action func(int32, int32, Point)) {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *projection) Pan(ctx *Context, delta PointF) {
|
||||
p.center = p.center.Add(delta.Mul(p.zoomInv))
|
||||
p.update(ctx.Renderer)
|
||||
}
|
||||
|
||||
func (p *projection) SetZoom(ctx *Context, center PointF, zoom float32) {
|
||||
if p.zoom == zoom {
|
||||
return
|
||||
}
|
||||
p.center = center.Sub(center.Sub(p.center).Mul(p.zoom / zoom))
|
||||
p.zoom = zoom
|
||||
p.update(ctx.Renderer)
|
||||
}
|
||||
|
||||
func (p *projection) ZoomOut(ctx *Context, center PointF) {
|
||||
if p.zoom <= .25 {
|
||||
return
|
||||
@ -114,12 +128,3 @@ func (p *projection) ZoomIn(ctx *Context, center PointF) {
|
||||
}
|
||||
p.SetZoom(ctx, center, 2*p.zoom)
|
||||
}
|
||||
|
||||
func (p *projection) SetZoom(ctx *Context, center PointF, zoom float32) {
|
||||
if p.zoom == zoom {
|
||||
return
|
||||
}
|
||||
p.center = center.Sub(center.Sub(p.center).Mul(p.zoom / zoom))
|
||||
p.zoom = zoom
|
||||
p.update(ctx.Renderer)
|
||||
}
|
||||
|
@ -101,6 +101,14 @@ func (r *terrainRenderer) Handle(ctx *Context, event sdl.Event) bool {
|
||||
r.project.ZoomOut(ctx, r.project.center)
|
||||
case sdl.K_KP_MINUS:
|
||||
r.project.ZoomOut(ctx, r.project.center)
|
||||
case sdl.K_w:
|
||||
r.project.Pan(ctx, PtF(-1, -1))
|
||||
case sdl.K_a:
|
||||
r.project.Pan(ctx, PtF(-1, 1))
|
||||
case sdl.K_s:
|
||||
r.project.Pan(ctx, PtF(1, 1))
|
||||
case sdl.K_d:
|
||||
r.project.Pan(ctx, PtF(1, -1))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user