Documentation
¶
Index ¶
- Constants
- Variables
- func AABBPlatform(a, b *AABB, aVel, bVel *Vec, h *HitInfo2) bool
- func LoadGame()
- func NewGame()
- func Overlap(a, b *AABB, hit *HitInfo) bool
- func OverlapSweep(staticA, b *AABB, bDelta Vec, hit *HitInfo) bool
- func OverlapSweep2(a, b *AABB, aDelta, bDelta Vec, hit *HitInfo) bool
- func SaveGame()
- func Segment(a *AABB, pos, delta, padding Vec, hit *HitInfo) bool
- func SpawnEffect(pos Vec, id uint8)
- func SpawnItem(pos Vec, id uint8, durability int) ecs.Entity
- func SpawnPlayer(pos Vec) ecs.Entity
- func SpawnProjectile(id uint8, pos, vel Vec) ecs.Entity
- type AABB
- func (a AABB) Bottom() float64
- func (a AABB) Left() float64
- func (a AABB) Right() float64
- func (a *AABB) SetBottom(b float64)
- func (a *AABB) SetLeft(l float64)
- func (a *AABB) SetRight(r float64)
- func (a *AABB) SetTop(t float64)
- func (a AABB) Size() Vec
- func (a AABB) Top() float64
- func (a AABB) TopLeft() Vec
- type AnimationIndex
- type AnimationTick
- type Camera
- type Collider
- type CollisionCallback
- type CollisionDelayer
- type Controller
- type Debug
- type Durability
- type Effects
- type Enemy
- type Facing
- type Game
- type Health
- type HitInfo
- type HitInfo2
- type HitTileInfo
- type Item
- type ItemID
- type MainMenu
- type Menu
- type MobileID
- type Platform
- type PlatformType
- type Player
- type Position
- type Projectile
- type Rotation
- type Spawn
- type UI
- type Vec
- type Velocity
Constants ¶
View Source
const ( Playing int = iota CraftingTable3x3 Crafting2x2 Furnace1x2 )
GameplayStates
View Source
const ( SnowballGravity float64 = 0.5 SnowballSpeedX float64 = 3.5 SnowballMaxFallVelocity float64 = 2.5 SnowballBounceHeight float64 = 9.0 ItemGravity float64 = 3.0 PlayerBestToolDamage float64 = 5.0 PlayerDefaultDamage float64 = 1.0 RaycastDist int = 4 // block unit Tick time.Duration = time.Second / 60 ItemCollisionDelay time.Duration = time.Second / 2 )
View Source
const EPSILON = 1e-8
View Source
const SpaceStr string = " "
Variables ¶
View Source
var ( Screen *ebiten.Image ScreenSize = Vec{500, 340} WindowScale = 2.0 )
Functions ¶
func AABBPlatform ¶
AABBPlatform moving platform b collision
func OverlapSweep ¶
OverlapSweep returns hit info for b
func OverlapSweep2 ¶
OverlapSweep2 returns hit info for b
func SpawnEffect ¶
func SpawnPlayer ¶
Types ¶
type AnimationIndex ¶
type AnimationIndex int // timing-related data for item animations.
type AnimationTick ¶
type AnimationTick float64 // timing-related data for item animations.
type Collider ¶
type Collider struct {
Collisions []HitTileInfo // List of collisions from last check
TileSize image.Point // Width and height of tiles
TileMap [][]uint8 // 2D grid of tile IDs
}
Collider handles collision detection between rectangles and a 2D tilemap
func (*Collider) Collide ¶
func (c *Collider) Collide(rect AABB, delta Vec, onCollide CollisionCallback) Vec
Collide checks for collisions when moving a rectangle and returns the allowed movement
type CollisionCallback ¶
type CollisionCallback func(hitInfos []HitTileInfo, delta Vec)
CollisionCallback is called when collisions occur, receiving collision info and final movement
type CollisionDelayer ¶
type Controller ¶
type Controller struct {
Acceleration float64
AirSkiddingDecel float64
CurrentState string
FallingDamageTempPosY float64
Gravity float64
JumpBoost float64
JumpBoostMultiplier float64
JumpHoldTime float64
JumpPower float64
JumpReleaseTimer float64
JumpTimer float64
MaxFallSpeed float64
MaxRunSpeed float64
MaxWalkSpeed float64
MinSpeedThresForJumpBoostMultiplier float64
PreviousState string
RunAcceleration float64
RunDeceleration float64
ShortJumpVelocity float64
SkiddingFriction float64
SkiddingJumpEnabled bool
SpeedJumpFactor float64
WalkAcceleration float64
WalkDeceleration float64
}
type Durability ¶
type Durability int
type Effects ¶
type Effects struct {
// contains filtered or unexported fields
}
block breaking effect system
type Game ¶
type HitTileInfo ¶
type HitTileInfo struct {
TileCoords image.Point // X,Y coordinates of the tile in the tilemap
Normal Vec // Normal vector of the collision (-1/0/1)
}
HitTileInfo stores information about a collision with a tile
type PlatformType ¶
type PlatformType string
type Projectile ¶
type Projectile struct {
// contains filtered or unexported fields
}
func (*Projectile) Draw ¶
func (p *Projectile) Draw()
func (*Projectile) Init ¶
func (p *Projectile) Init()
func (*Projectile) Update ¶
func (p *Projectile) Update()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.