Documentation ¶
Index ¶
- Variables
- func EuclideanCollision(ax, ay, bx, by, l float64) bool
- func LevelMapToPlayerStageCoordinate(level string) (stageX, stageY stageCoordinate, err error)
- func NewGame() *game
- func NewRange(small, large float64) float64Range
- func RectangleCollision(a, b RectangleLocationGetter) bool
- type Crate
- func (v Crate) DX() float64
- func (v Crate) DY() float64
- func (v Crate) DZ() float64
- func (c Crate) Draw(screen *ebiten.Image) error
- func (c *Crate) HandleInput(g *game)
- func (c Crate) Height() int
- func (s Crate) HorizontalRange() float64Range
- func (s Crate) LeftSide() float64
- func (s Crate) LowerSide() float64
- func (p Crate) RectangleCollision(e RectangleLocationGetter) bool
- func (s Crate) RightSide() float64
- func (v Crate) SetDX(dx float64)
- func (v Crate) SetDY(dy float64)
- func (v Crate) SetDZ(dz float64)
- func (l *Crate) SetLeftSide(x float64)
- func (l *Crate) SetLowerSide(y float64)
- func (l *Crate) SetRightSide(x float64)
- func (d *Crate) SetToBeDestroyed()
- func (l *Crate) SetUpperSide(y float64)
- func (l *Crate) SetX(x float64)
- func (l *Crate) SetY(y float64)
- func (c *Crate) Step(g *game)
- func (d Crate) ToBeDestroyed() bool
- func (s Crate) UpperSide() float64
- func (s Crate) VerticalRange() float64Range
- func (c Crate) Width() int
- func (s Crate) X() float64
- func (s Crate) Y() float64
- type Destroyabler
- type Drawer
- type Entities
- type Entity
- type GameState
- type Kharedi
- func (k Kharedi) Draw(screen *ebiten.Image) error
- func (c *Kharedi) Fall()
- func (c Kharedi) FindBlockings(ss []RectangleLocationGetter) (blockedOnRight, blockedOnUp, blockedOnLeft, blockedOnDown bool)
- func (c *Kharedi) HandleInput(g *game)
- func (s Kharedi) Height() int
- func (d *Kharedi) SetToBeDestroyed()
- func (k *Kharedi) Step(g *game)
- func (d Kharedi) ToBeDestroyed() bool
- func (s Kharedi) Width() int
- type LocationGetter
- type LocationSetter
- type Player
- func (c Player) Draw(screen *ebiten.Image) error
- func (c *Player) Fall()
- func (c Player) FindBlockings(ss []RectangleLocationGetter) (blockedOnRight, blockedOnUp, blockedOnLeft, blockedOnDown bool)
- func (c *Player) HandleInput(g *game)
- func (d *Player) SetToBeDestroyed()
- func (c *Player) Step(g *game)
- func (d Player) ToBeDestroyed() bool
- type Projectile
- func (v Projectile) DX() float64
- func (v Projectile) DY() float64
- func (v Projectile) DZ() float64
- func (p Projectile) Draw(screen *ebiten.Image) error
- func (p Projectile) HandleInput(g *game)
- func (p Projectile) Height() float64
- func (s Projectile) HorizontalRange() float64Range
- func (p Projectile) IsProjectile() bool
- func (s Projectile) LeftSide() float64
- func (s Projectile) LowerSide() float64
- func (p Projectile) RectangleCollision(e RectangleLocationGetter) bool
- func (s Projectile) RightSide() float64
- func (v Projectile) SetDX(dx float64)
- func (v Projectile) SetDY(dy float64)
- func (v Projectile) SetDZ(dz float64)
- func (l *Projectile) SetLeftSide(x float64)
- func (l *Projectile) SetLowerSide(y float64)
- func (l *Projectile) SetRightSide(x float64)
- func (d *Projectile) SetToBeDestroyed()
- func (l *Projectile) SetUpperSide(y float64)
- func (l *Projectile) SetX(x float64)
- func (l *Projectile) SetY(y float64)
- func (p *Projectile) Step(g *game)
- func (d Projectile) ToBeDestroyed() bool
- func (s Projectile) UpperSide() float64
- func (s Projectile) VerticalRange() float64Range
- func (p Projectile) Width() float64
- func (s Projectile) X() float64
- func (s Projectile) Y() float64
- type Projectiler
- type RectangleLocationGetter
- type RectangleLocationSetter
- type RectangleMover
- type Sprite
- type VelocityGetter
- type VelocitySetter
- type Wall
- func (p Wall) Draw(screen *ebiten.Image) error
- func (s Wall) HorizontalRange() float64Range
- func (s Wall) LeftSide() float64
- func (s Wall) LowerSide() float64
- func (p Wall) RectangleCollision(e RectangleLocationGetter) bool
- func (s Wall) RightSide() float64
- func (l *Wall) SetLeftSide(x float64)
- func (l *Wall) SetLowerSide(y float64)
- func (l *Wall) SetRightSide(x float64)
- func (l *Wall) SetUpperSide(y float64)
- func (l *Wall) SetX(x float64)
- func (l *Wall) SetY(y float64)
- func (p *Wall) Step(g *game)
- func (s Wall) UpperSide() float64
- func (s Wall) VerticalRange() float64Range
- func (s Wall) X() float64
- func (s Wall) Y() float64
Constants ¶
This section is empty.
Variables ¶
View Source
var Assets struct { Sounds map[string][]byte Images map[string][]byte }
View Source
var (
Images map[string]*ebiten.Image
)
Functions ¶
func EuclideanCollision ¶
func NewRange ¶
func NewRange(small, large float64) float64Range
NewRange creates a float64Range out of two float64. It doesn't care about order, as it figures out which of the provided values is small and which is large for you.
Fun fact: floats sounds like פלוץ.
func RectangleCollision ¶
func RectangleCollision(a, b RectangleLocationGetter) bool
Types ¶
type Crate ¶
type Crate struct {
// contains filtered or unexported fields
}
func (*Crate) HandleInput ¶
func (c *Crate) HandleInput(g *game)
func (Crate) HorizontalRange ¶
func (s Crate) HorizontalRange() float64Range
func (Crate) RectangleCollision ¶
func (p Crate) RectangleCollision(e RectangleLocationGetter) bool
RectangleCollision checks if the calling Projectile and the provided Entity overlap in their rectangles.
LowX | HighX | | +---+.. ..+---+ -- LowY |p..|.. ..|..p| |.+---+ +---+.| |.|.|.| |.|.|.| +-|-+.| |.+-|-+ -- HighY ..|..e| |e..|.. ..+---+ +---+.. ..+---+ +---+.. ..|...| |...|.. +-|-+.| |.+-|-+ |.|.|.| |.|.|.| |.+---+ +---+.| |...|.. ..|...| +---+.. ..+---+
func (*Crate) SetLeftSide ¶
func (l *Crate) SetLeftSide(x float64)
func (*Crate) SetLowerSide ¶
func (l *Crate) SetLowerSide(y float64)
func (*Crate) SetRightSide ¶
func (l *Crate) SetRightSide(x float64)
func (*Crate) SetToBeDestroyed ¶
func (d *Crate) SetToBeDestroyed()
func (*Crate) SetUpperSide ¶
func (l *Crate) SetUpperSide(y float64)
func (Crate) ToBeDestroyed ¶
func (d Crate) ToBeDestroyed() bool
func (Crate) VerticalRange ¶
func (s Crate) VerticalRange() float64Range
type Destroyabler ¶
type Destroyabler interface { ToBeDestroyed() bool SetToBeDestroyed() }
type Entity ¶
type Entity interface { HandleInput(*game) Step(*game) Drawer Destroyabler Projectiler RectangleLocationGetter RectangleLocationSetter VelocityGetter VelocitySetter }
type Kharedi ¶
type Kharedi struct {
// contains filtered or unexported fields
}
func (Kharedi) FindBlockings ¶
func (c Kharedi) FindBlockings(ss []RectangleLocationGetter) ( blockedOnRight, blockedOnUp, blockedOnLeft, blockedOnDown bool, )
func (*Kharedi) HandleInput ¶
func (c *Kharedi) HandleInput(g *game)
func (*Kharedi) SetToBeDestroyed ¶
func (d *Kharedi) SetToBeDestroyed()
func (Kharedi) ToBeDestroyed ¶
func (d Kharedi) ToBeDestroyed() bool
type LocationGetter ¶
type LocationSetter ¶
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
func (Player) FindBlockings ¶
func (c Player) FindBlockings(ss []RectangleLocationGetter) ( blockedOnRight, blockedOnUp, blockedOnLeft, blockedOnDown bool, )
func (*Player) HandleInput ¶
func (c *Player) HandleInput(g *game)
func (*Player) SetToBeDestroyed ¶
func (d *Player) SetToBeDestroyed()
func (Player) ToBeDestroyed ¶
func (d Player) ToBeDestroyed() bool
type Projectile ¶
type Projectile struct {
// contains filtered or unexported fields
}
func (Projectile) HandleInput ¶
func (p Projectile) HandleInput(g *game)
func (Projectile) Height ¶
func (p Projectile) Height() float64
func (Projectile) HorizontalRange ¶
func (s Projectile) HorizontalRange() float64Range
func (Projectile) IsProjectile ¶
func (p Projectile) IsProjectile() bool
func CircleCollision(ax, ay, bx, by, tresholdDistance float64) bool { distanceBetweenPoints := math.Sqrt(math.Pow(ax-bx, 2) + math.Pow(ay-by, 2)) if distanceBetweenPoints <= tresholdDistance { return true } return false }
func (Projectile) RectangleCollision ¶
func (p Projectile) RectangleCollision(e RectangleLocationGetter) bool
RectangleCollision checks if the calling Projectile and the provided Entity overlap in their rectangles.
LowX | HighX | | +---+.. ..+---+ -- LowY |p..|.. ..|..p| |.+---+ +---+.| |.|.|.| |.|.|.| +-|-+.| |.+-|-+ -- HighY ..|..e| |e..|.. ..+---+ +---+.. ..+---+ +---+.. ..|...| |...|.. +-|-+.| |.+-|-+ |.|.|.| |.|.|.| |.+---+ +---+.| |...|.. ..|...| +---+.. ..+---+
func (*Projectile) SetLeftSide ¶
func (l *Projectile) SetLeftSide(x float64)
func (*Projectile) SetLowerSide ¶
func (l *Projectile) SetLowerSide(y float64)
func (*Projectile) SetRightSide ¶
func (l *Projectile) SetRightSide(x float64)
func (*Projectile) SetToBeDestroyed ¶
func (d *Projectile) SetToBeDestroyed()
func (*Projectile) SetUpperSide ¶
func (l *Projectile) SetUpperSide(y float64)
func (*Projectile) Step ¶
func (p *Projectile) Step(g *game)
func (Projectile) ToBeDestroyed ¶
func (d Projectile) ToBeDestroyed() bool
func (Projectile) VerticalRange ¶
func (s Projectile) VerticalRange() float64Range
func (Projectile) Width ¶
func (p Projectile) Width() float64
type Projectiler ¶
type Projectiler interface {
IsProjectile() bool
}
type RectangleLocationGetter ¶
type RectangleLocationSetter ¶
type RectangleMover ¶
type RectangleMover interface { RectangleLocationGetter VelocityGetter }
type VelocityGetter ¶
type VelocitySetter ¶
type Wall ¶
type Wall struct {
// contains filtered or unexported fields
}
func LevelMapToWalls ¶
func (Wall) HorizontalRange ¶
func (s Wall) HorizontalRange() float64Range
func (Wall) RectangleCollision ¶
func (p Wall) RectangleCollision(e RectangleLocationGetter) bool
RectangleCollision checks if the calling Projectile and the provided Entity overlap in their rectangles.
LowX | HighX | | +---+.. ..+---+ -- LowY |p..|.. ..|..p| |.+---+ +---+.| |.|.|.| |.|.|.| +-|-+.| |.+-|-+ -- HighY ..|..e| |e..|.. ..+---+ +---+.. ..+---+ +---+.. ..|...| |...|.. +-|-+.| |.+-|-+ |.|.|.| |.|.|.| |.+---+ +---+.| |...|.. ..|...| +---+.. ..+---+
func (*Wall) SetLeftSide ¶
func (l *Wall) SetLeftSide(x float64)
func (*Wall) SetLowerSide ¶
func (l *Wall) SetLowerSide(y float64)
func (*Wall) SetRightSide ¶
func (l *Wall) SetRightSide(x float64)
func (*Wall) SetUpperSide ¶
func (l *Wall) SetUpperSide(y float64)
func (Wall) VerticalRange ¶
func (s Wall) VerticalRange() float64Range
Click to show internal directories.
Click to hide internal directories.