Bullet hell video game
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
789 B

package component
import (
"math/rand"
. "code.rocketnine.space/tslocum/brownboxbatman/ecs"
"code.rocketnine.space/tslocum/gohan"
)
type CreepComponent struct {
Active bool
Health int
FireAmount int
FireRate int // In ticks
FireTicks int //Ticks until next action
Movement int
Movements [][3]float64 // X, Y, pre-delay in ticks
MovementTicks int // Ticks until next action
DamageTicks int
Rand *rand.Rand
}
const (
CreepSnowGunner = iota + 1
CreepSnowmanHead
)
var CreepComponentID = ECS.NewComponentID()
func (p *CreepComponent) ComponentID() gohan.ComponentID {
return CreepComponentID
}
func Creep(ctx *gohan.Context) *CreepComponent {
c, ok := ctx.Component(CreepComponentID).(*CreepComponent)
if !ok {
return nil
}
return c
}