Moving to standardgamepad buttons.
This commit is contained in:
23
game.go
23
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 {
|
||||
|
||||
Reference in New Issue
Block a user