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)
|
op.GeoM.Translate(g.hero.Pos.X, g.hero.Pos.Y)
|
||||||
screen.DrawImage(weaponImage, op)
|
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 {
|
for _, target := range g.targets {
|
||||||
target.Draw()
|
target.Draw()
|
||||||
|
|
||||||
@@ -414,16 +426,19 @@ func (g *Game) ResetTargetTouches() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) AppendProjectiles() {
|
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] = 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() {
|
func (g *Game) HandleInput() {
|
||||||
if len(g.gamepadIDs) > 0 {
|
if len(g.gamepadIDs) > 0 {
|
||||||
if ebiten.IsGamepadButtonPressed(0, ebiten.GamepadButton11) {
|
if inpututil.IsStandardGamepadButtonJustPressed(0, ebiten.StandardGamepadButtonRightStick) {
|
||||||
if !g.explosion.Active && !g.gameover {
|
if !g.explosion.Active && !g.gameover {
|
||||||
g.explosion.SetOrigin(g.hero.Pos)
|
g.explosion.SetOrigin(g.hero.Pos)
|
||||||
g.explosion.Reset()
|
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 {
|
if g.gameover {
|
||||||
g.reset = true
|
g.reset = true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
2
hero.go
2
hero.go
@@ -58,6 +58,7 @@ type Hero struct {
|
|||||||
Lastpos Coordinates
|
Lastpos Coordinates
|
||||||
Action HeroAction
|
Action HeroAction
|
||||||
cycles int
|
cycles int
|
||||||
|
Upgrade bool
|
||||||
rotating bool
|
rotating bool
|
||||||
Toggled bool
|
Toggled bool
|
||||||
Hit bool
|
Hit bool
|
||||||
@@ -77,6 +78,7 @@ func NewHero() *Hero {
|
|||||||
rotating: false,
|
rotating: false,
|
||||||
Toggled: false,
|
Toggled: false,
|
||||||
dyingcount: 0,
|
dyingcount: 0,
|
||||||
|
Upgrade: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Maks.Fill(color.White)
|
m.Maks.Fill(color.White)
|
||||||
|
|||||||
Reference in New Issue
Block a user