diff --git a/game.go b/game.go index 1b2a9c5..4b0b57f 100644 --- a/game.go +++ b/game.go @@ -186,6 +186,18 @@ func (g *Game) Draw(screen *ebiten.Image) { op.GeoM.Translate(g.hero.Pos.X, g.hero.Pos.Y) screen.DrawImage(weaponImage, op) + //secondary/upgraded weapon sprite; in testing proves sort of distracting + /* + if g.hero.Upgrade { + op.GeoM.Reset() + op.GeoM.Translate(-16, -16) + op.GeoM.Scale(0.75, 0.75) + op.GeoM.Translate(16, 0) + op.GeoM.Rotate(g.hero.Angle + math.Pi) + op.GeoM.Translate(g.hero.Pos.X, g.hero.Pos.Y) + screen.DrawImage(weaponImage, op) + }*/ + for _, target := range g.targets { target.Draw() @@ -414,16 +426,19 @@ func (g *Game) ResetTargetTouches() { } func (g *Game) AppendProjectiles() { - if g.counter%14 == 0 && ebiten.IsGamepadButtonPressed(0, ebiten.GamepadButton7) { + if g.counter%14 == 0 && ebiten.IsStandardGamepadButtonPressed(0, ebiten.StandardGamepadButtonFrontBottomRight) { g.projectiles[g.counter] = NewProjectile(Coordinates{X: g.hero.Pos.X, Y: g.hero.Pos.Y}, g.hero.Angle, 5.) - g.projectiles[g.counter+1] = NewProjectile(Coordinates{X: g.hero.Pos.X, Y: g.hero.Pos.Y}, g.hero.Angle+math.Pi, 5.) + + if g.hero.Upgrade { + g.projectiles[g.counter+1] = NewProjectile(Coordinates{X: g.hero.Pos.X, Y: g.hero.Pos.Y}, g.hero.Angle+math.Pi, 5.) + } } } func (g *Game) HandleInput() { if len(g.gamepadIDs) > 0 { - if ebiten.IsGamepadButtonPressed(0, ebiten.GamepadButton11) { + if inpututil.IsStandardGamepadButtonJustPressed(0, ebiten.StandardGamepadButtonRightStick) { if !g.explosion.Active && !g.gameover { g.explosion.SetOrigin(g.hero.Pos) g.explosion.Reset() @@ -431,7 +446,7 @@ func (g *Game) HandleInput() { } } - if inpututil.IsGamepadButtonJustPressed(0, ebiten.GamepadButton9) { + if inpututil.IsStandardGamepadButtonJustPressed(0, ebiten.StandardGamepadButtonCenterRight) { if g.gameover { g.reset = true } else { diff --git a/hero.go b/hero.go index 650ed71..7743cfc 100644 --- a/hero.go +++ b/hero.go @@ -58,6 +58,7 @@ type Hero struct { Lastpos Coordinates Action HeroAction cycles int + Upgrade bool rotating bool Toggled bool Hit bool @@ -77,6 +78,7 @@ func NewHero() *Hero { rotating: false, Toggled: false, dyingcount: 0, + Upgrade: true, } m.Maks.Fill(color.White)