Metroidvania 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.

34 lines
746 B

package entity
import (
"time"
"code.rocketnine.space/tslocum/gohan"
"code.rocketnine.space/tslocum/monovania/asset"
"code.rocketnine.space/tslocum/monovania/component"
"code.rocketnine.space/tslocum/monovania/engine"
)
func NewPlayer(x, y float64) gohan.Entity {
player := engine.Engine.NewEntity()
engine.Engine.AddComponent(player, &component.PositionComponent{
X: x,
Y: y,
})
engine.Engine.AddComponent(player, &component.VelocityComponent{})
weapon := &component.WeaponComponent{
Damage: 1,
FireRate: 100 * time.Millisecond,
BulletSpeed: 15,
}
engine.Engine.AddComponent(player, weapon)
engine.Engine.AddComponent(player, &component.SpriteComponent{
Image: asset.PlayerSS.IdleR,
})
return player
}