base_objects

package
v0.0.0-...-255f02d Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractObject

type AbstractObject struct {
	IAbstractObject
	Id           int
	Location     Vector
	Width        float64
	Height       float64
	Velocity     Vector
	Acceleration Vector
	Gravity      Vector
	Mass         float64
	IsPlatform   bool // Platform is an object the player (or some other entity) can stand on
	Collides     bool // Does this collide with other game objects (can they pass through it)
}

func NewAbstractObject

func NewAbstractObject(id int, location Vector, width float64, height float64, mass float64, isPlatform bool, collides bool) *AbstractObject

func (*AbstractObject) ApplyForce

func (obj *AbstractObject) ApplyForce(force Vector)

func (*AbstractObject) ApplyFriction

func (obj *AbstractObject) ApplyFriction()

func (*AbstractObject) ApplyGravity

func (obj *AbstractObject) ApplyGravity()

func (*AbstractObject) BounceHorizontal

func (obj *AbstractObject) BounceHorizontal()

func (*AbstractObject) BounceVertical

func (obj *AbstractObject) BounceVertical()

type IAbstractObject

type IAbstractObject interface {
	Draw(ctx *cairo.Context, screen ScreenInfo)
	Update(objects []*AbstractObject, screen ScreenInfo)
	HandleKeyPress(keyId uint, state gdk.ModifierType)
	HandleKeyRelease(keyId uint, state gdk.ModifierType)
}

type RGBA

type RGBA struct {
	R, G, B, A float64
}

func NewRGBA

func NewRGBA(R, G, B, A float64) RGBA

type ScreenInfo

type ScreenInfo struct {
	Left, Right, Bottom, Top float64
	Height, Width            float64
}

type Vector

type Vector struct {
	X, Y float64
}

func VectorAdd

func VectorAdd(a Vector, b Vector) Vector

func VectorDivideByScalar

func VectorDivideByScalar(vec Vector, s float64) Vector

func VectorMultiplyByScalar

func VectorMultiplyByScalar(vec Vector, s float64) Vector

func VectorSub

func VectorSub(a Vector, b Vector) Vector

func (*Vector) Add

func (a *Vector) Add(b Vector)

func (Vector) DivideByScalar

func (a Vector) DivideByScalar(s float64)

func (Vector) Dot

func (a Vector) Dot(b Vector) float64

func (Vector) Length

func (a Vector) Length() float64

func (*Vector) Limit

func (a *Vector) Limit(limit float64)

func (*Vector) MultiplyByScalar

func (a *Vector) MultiplyByScalar(s float64)

func (*Vector) Normalize

func (a *Vector) Normalize()

func (*Vector) Sub

func (a *Vector) Sub(b Vector)

Jump to

Keyboard shortcuts

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