Housekeeping.
This commit is contained in:
@@ -223,6 +223,9 @@ func (c *Canvas) Initialize() {
|
||||
|
||||
//temporary
|
||||
c.hero.Action = elements.HeroActionDefault
|
||||
|
||||
c.holster.SetActiveWeapon(gamedata.WeaponTypeGun)
|
||||
c.laser.SetFiring(false)
|
||||
}
|
||||
|
||||
func (c *Canvas) UpdateHero() {
|
||||
@@ -360,12 +363,13 @@ func (c *Canvas) UpdateProjectiles() {
|
||||
|
||||
func (c *Canvas) UpdateLaser() {
|
||||
c.laser.Update()
|
||||
|
||||
c.laser.SetFiring(c.lastInputs.Shot)
|
||||
|
||||
if c.lastInputs.Shot {
|
||||
c.laser.SetPosition(c.hero.Pos)
|
||||
c.laser.SetAngle(c.lastInputs.ShotAngle)
|
||||
}
|
||||
c.laser.SetFiring(c.lastInputs.Shot)
|
||||
if c.lastInputs.Shot {
|
||||
|
||||
c.laserMask.Clear()
|
||||
lpos := c.laser.GetPosition()
|
||||
op := &ebiten.DrawImageOptions{}
|
||||
|
||||
@@ -17,6 +17,13 @@ func NewHolster() *Holster {
|
||||
return holster
|
||||
}
|
||||
|
||||
func (h *Holster) SetActiveWeapon(wt gamedata.WeaponType) {
|
||||
_, ok := h.guns[wt]
|
||||
if ok {
|
||||
h.activewp = wt
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Holster) GetActiveWeapon() Weapon {
|
||||
return h.guns[h.activewp]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user