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.

31 lines
685 B

8 months ago
package entity
import (
"code.rocketnine.space/tslocum/gohan"
"code.rocketnine.space/tslocum/monovania/asset"
"code.rocketnine.space/tslocum/monovania/component"
7 months ago
"code.rocketnine.space/tslocum/monovania/engine"
8 months ago
)
func NewBullet(x, y, xSpeed, ySpeed float64) gohan.Entity {
7 months ago
bullet := engine.Engine.NewEntity()
8 months ago
7 months ago
engine.Engine.AddComponent(bullet, &component.PositionComponent{
8 months ago
X: x,
Y: y,
})
7 months ago
engine.Engine.AddComponent(bullet, &component.VelocityComponent{
8 months ago
X: xSpeed,
Y: ySpeed,
})
7 months ago
engine.Engine.AddComponent(bullet, &component.SpriteComponent{
8 months ago
Image: asset.ImgWhiteSquare,
})
7 months ago
engine.Engine.AddComponent(bullet, &component.BulletComponent{})
8 months ago
return bullet
}