game

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WindowTitle  = "Worm in the Pipes"
	WindowWidth  = 960
	WindowHeight = 640
	WindowScale  = 1
	CreditText   = "Created by Silbinary Wolf | Art by milkroscope | Music by Magicdweedoo"
)
View Source
const (
	DepthBackground = 10
	DepthDirt       = 1
	DepthWormBody   = -5
	DepthWorm       = -10
	DepthMenu       = -15
)
View Source
const (
	LerpSpeed = 0.1
	LerpTimer = 4 * (LerpSpeed * 60)
)
View Source
const (
	FrontCityHspeed = -2
	BackCityHspeed  = -1
)
View Source
const (
	WormStartingBodyParts = 1
	WormMaxBodyParts      = 10
	WormStartX            = 304
	WormStartY            = 528
	WormLeapPower         = -21
	WormJumpGravity       = 0.66
	WormFallGravity       = 0.56
	WormDieGravity        = 0.58
	WormSproutSpeed       = 0.05
	WormSinCounterStart   = 9999999 // used in original game. Could just count up instead but kept it
)
View Source
const (
	SproutLerp      = 0.1
	SproutLerpSpeed = 0.1
	SeperationWidth = 40 // Taken from game logic: (sprite_get_width(sprite_index) >> 1) + (sprite_get_width(sprite_index) >> 2);
)
View Source
const (
	// DesignedMaxTPS states that game logic is designed to simulate at 1/60 of a second
	// ie. alarms, move speed, animation speed
	DesignedMaxTPS = 60
)
View Source
const (
	MenuFadeOutSpeed = 0.05
)
View Source
const (
	MenuGameOverAccelerationSpeed = 3
)

Variables

Functions

func HandleCollisionForWormOrWormPart

func HandleCollisionForWormOrWormPart(master *Worm, x, y float64)

func LerpBias

func LerpBias(time, bias float64) float64

Lerp Bias http://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/ http://demofox.org/biasgain.html

LerpBias was a script in the original Game Maker source code and has been copied across as is, including the comments referencing sources above.

func LerpGain

func LerpGain(time, gain float64) float64

Lerp Gain http://blog.demofox.org/2012/09/24/bias-and-gain-are-your-friend/ http://demofox.org/biasgain.html

LerpGain was a script in the original Game Maker source code and has been copied across as is, including the comments referencing sources above.

func WallSpeed

func WallSpeed() float64

Types

type Background

type Background struct {
	gml.Object
	IsPaused         bool
	BackCityOffset   float64
	FrontCityOffset  float64
	FrontGrassOffset float64
}

func (*Background) Create

func (self *Background) Create()

func (*Background) Draw

func (self *Background) Draw()

func (*Background) Update

func (self *Background) Update()

type Checkpoint

type Checkpoint struct {
	gml.Object
}

func (*Checkpoint) Create

func (self *Checkpoint) Create()

func (*Checkpoint) Update

func (self *Checkpoint) Update()

type GameController

type GameController struct {
	gml.Controller
	PersistentGameData
	PreviousRound GameScore
	CurrentRound  GameScore

	Notification Notification
	Player       gml.InstanceIndex
	MusicPlaying audio.SoundIndex
	Score        int
}

func (*GameController) GamePostDraw

func (*GameController) GamePostDraw()

func (*GameController) GamePreUpdate

func (*GameController) GamePreUpdate()

func (*GameController) GameReset

func (*GameController) GameReset()

func (*GameController) GameStart

func (*GameController) GameStart()

func (*GameController) HasWormStopped

func (*GameController) HasWormStopped() bool

func (*GameController) MusicRandomizeTrack

func (*GameController) MusicRandomizeTrack()

type GameScore

type GameScore struct {
	MedalWorm Medal
	MedalWing Medal
}

type LerpDir

type LerpDir int
const (
	LerpIn  LerpDir = 0
	LerpOut LerpDir = 1
)

type Medal

type Medal int
const (
	MedalNone   Medal = 0
	MedalBronze Medal = 1
	MedalSilver Medal = 2
	MedalGold   Medal = 3
)
type Menu struct {
	gml.Object
	ImageAlpha       float64
	IsHoveringOnMenu bool
	IsFadingAway     bool
}
func (self *Menu) Create()
func (self *Menu) Destroy()
func (self *Menu) Draw()
func (self *Menu) Update()
type MenuGameover struct {
	gml.Object
	Physics
	RetryButton             gml.Rect
	IsHoveringOnMenu        bool
	DisplayScore            GameScore
	MedalDisplayUpdateTimer alarm.Alarm
}
func (self *MenuGameover) Create()
func (self *MenuGameover) Destroy()
func (self *MenuGameover) Draw()
func (self *MenuGameover) Update()

type Notification

type Notification struct {
	Active  bool
	Text    string
	Lerp    float64
	LerpDir LerpDir
}

func (*Notification) Draw

func (self *Notification) Draw()

func (*Notification) SetNotification

func (self *Notification) SetNotification(text string)

func (*Notification) Update

func (self *Notification) Update()

type PersistentGameData

type PersistentGameData struct {
	// todo(Jake): 2019-03-13
	// Maybe reimplement saving for the options / high score system
	SoundDisabled bool
	MusicDisabled bool
}

type Physics

type Physics struct {
	Speed   gml.Vec
	Gravity float64
}

func (*Physics) Update

func (phys *Physics) Update(self *gml.Object)

type Wall

type Wall struct {
	gml.Object

	// Special flag where wall is jutting into the ground
	// but not enough that the player should die.
	DontKillPlayerIfInDirt bool

	// Special flag for when you reset the game, walls that
	// existed from the previous game will still render on-screen
	// but they won't kill you
	DontKillPlayer bool
}

func (*Wall) Create

func (self *Wall) Create()

func (*Wall) Update

func (self *Wall) Update()

type WallSpawner

type WallSpawner struct {
	WallList            []wall.WallInfo
	SpawnWallTimer      alarm.Alarm
	PreviousWallSpawned int
}

func (*WallSpawner) Reset

func (self *WallSpawner) Reset()

func (*WallSpawner) Update

func (self *WallSpawner) Update(roomInstanceIndex gml.RoomInstanceIndex)

type Worm

type Worm struct {
	gml.Object
	Physics
	WormLag
	WallSpawner
	BodyParts [WormMaxBodyParts]WormBody

	Start       gml.Vec
	Score       float64
	Dead        bool
	InAir       bool
	FlapCounter float64
	WingCount   float64
	// contains filtered or unexported fields
}

func (*Worm) CalcMedals

func (self *Worm) CalcMedals()

func (*Worm) Create

func (self *Worm) Create()

func (*Worm) Draw

func (self *Worm) Draw()

func (*Worm) Reset

func (self *Worm) Reset()

func (*Worm) ScoreIncrease

func (self *Worm) ScoreIncrease()

func (*Worm) SetStartingBodyParts

func (self *Worm) SetStartingBodyParts(bodyParts int)

SetStartingBodyParts allows the Create() event and tests setup how many body parts trail the worm

func (*Worm) TriggerDeath

func (self *Worm) TriggerDeath()

func (*Worm) Update

func (self *Worm) Update()

type WormBody

type WormBody struct {
	gml.Vec
	WormLag
	HasSprouted bool
	SproutLerp  float64
}

func (*WormBody) SeperationWidth

func (self *WormBody) SeperationWidth() float64

type WormHole

type WormHole struct {
	gml.Object
}

func (*WormHole) Create

func (self *WormHole) Create()

func (*WormHole) Update

func (self *WormHole) Update()

type WormLag

type WormLag struct {
	LagTimer alarm.Alarm
	YLag     float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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