magnet

package
v0.0.0-...-8d8ddab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MagnetPowerRange float64 = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type BarMagnet

type BarMagnet struct {
	// contains filtered or unexported fields
}

func NewBarMagnet

func NewBarMagnet(width, height float64, root, tip PoleType, loc Location, rootV, tipV Velocity) *BarMagnet

func (*BarMagnet) GeoM

func (m *BarMagnet) GeoM() ebiten.GeoM

func (*BarMagnet) RootVDebug

func (m *BarMagnet) RootVDebug() (x1, y1, x2, y2 float64, c color.Color)

func (*BarMagnet) StickRoot

func (m *BarMagnet) StickRoot(pole Pole) bool

func (*BarMagnet) StickTip

func (m *BarMagnet) StickTip(pole Pole) bool

func (*BarMagnet) TipVDebug

func (m *BarMagnet) TipVDebug() (x1, y1, x2, y2 float64, c color.Color)

func (*BarMagnet) Update

func (m *BarMagnet) Update(poles []Pole)

type Body

type Body struct {
	// contains filtered or unexported fields
}

func NewBody

func NewBody(width, height, armPoleYOffset, legPoleXOffset float64) *Body

func (*Body) GeoM

func (b *Body) GeoM() ebiten.GeoM

func (*Body) Loc

func (b *Body) Loc() (x, y float64)

func (*Body) Pole

func (b *Body) Pole(pt part.PartType) Pole

func (*Body) Poles

func (b *Body) Poles() map[part.PartType]Pole

func (*Body) UpdateLoc

func (b *Body) UpdateLoc(x, y float64)

type Location

type Location struct {
	X float64
	Y float64
}

func (Location) Move

func (l Location) Move(v Velocity) Location

type Pole

type Pole struct {
	Type PoleType
	X    float64
	Y    float64
}

func (Pole) Affected

func (p Pole) Affected(other Pole) Power

func (Pole) Stick

func (p Pole) Stick(other Pole) bool

type PoleType

type PoleType int
const (
	PoleTypeNone PoleType = iota
	PoleTypeN
	PoleTypeS
)

func (PoleType) Stick

func (pt PoleType) Stick(other PoleType) bool

type Power

type Power struct {
	X float64
	Y float64
}

type Velocity

type Velocity struct {
	X float64
	Y float64
}

func (Velocity) Accelerate

func (v Velocity) Accelerate(p Power) Velocity

func (Velocity) Avarage

func (v Velocity) Avarage(other Velocity) Velocity

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL