Version: v0.0.0-...-c7cdaa0 Latest Latest

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

Go to latest
Published: Sep 3, 2013 License: MIT Imports: 12 Imported by: 4




View Source
const (
	SideRight       = Tile(1 << iota)
	SideUp          = Tile(1 << iota)
	SideRight2      = Tile(1 << iota)
	SideUp2         = Tile(1 << iota)
	CollisionLeft   = Tile(1 << iota)
	CollisionRight  = Tile(1 << iota)
	CollisionUp     = Tile(1 << iota)
	CollisionDown   = Tile(1 << iota)
	LayerConnection = Tile(1 << iota)

	SideLeft  = Tile(0)
	SideDown  = SideRight | SideUp
	SideReset = ^SideDown

	SideLeft2  = Tile(0)
	SideDown2  = SideRight2 | SideUp2
	SideReset2 = ^SideDown2

	CollisionNone  = Tile(0)
	CollisionAll   = CollisionLeft | CollisionRight | CollisionUp | CollisionDown
	CollitionReset = ^CollisionAll

	LayerConnectionReset = ^LayerConnection


View Source
var (
	GameSceneGeneral *GameScene
	TileAtlas        *engine.ManagedAtlas
	TileIDs          []engine.ID
	PlayerID         engine.ID

	MainPlayer *Player
	Layers     []*Map
	Mouse      *engine.GameObject


func CheckError

func CheckError(err error) bool


type CameraController

type CameraController struct {
	Speed float64

func NewCameraCtl

func NewCameraCtl(speed float64) *CameraController

func (*CameraController) Update

func (sp *CameraController) Update()

type GameScene

type GameScene struct {
	Layer1 *engine.GameObject
	Layer2 *engine.GameObject
	Layer3 *engine.GameObject

func (*GameScene) Load

func (s *GameScene) Load()

func (*GameScene) LoadTextures

func (s *GameScene) LoadTextures()

func (*GameScene) New

func (s *GameScene) New() engine.Scene

type Map

type Map struct {
	Sprite *engine.Sprite

	Tiles []Tile

	Width, Height int
	TileSize      float32

	Disco       float32
	DiscoStyle  int
	EnableDisco bool

	Layer int
	// contains filtered or unexported fields

func NewMap

func NewMap(tex *engine.Texture, uv engine.AnimatedUV) *Map

func (*Map) CheckCollision

func (m *Map) CheckCollision(worldPosition engine.Vector, width, height float32) bool

func (*Map) Draw

func (m *Map) Draw()

func (*Map) GenerateCollision

func (m *Map) GenerateCollision()

func (*Map) GenerateCollision2

func (m *Map) GenerateCollision2()

func (*Map) GetCollisions

func (m *Map) GetCollisions(worldPosition engine.Vector, width, height float32) (x, y []int)

func (*Map) GetCollisions2

func (m *Map) GetCollisions2(worldPosition engine.Vector, width, height float32, xCollisions, yCollisions []int) (x, y []int)

func (*Map) GetTile

func (m *Map) GetTile(x, y int) (tile Tile, exists bool)

func (*Map) GetTilePos

func (m *Map) GetTilePos(x, y int) (pos engine.Vector, exists bool)

func (*Map) IsTileWalkabke

func (m *Map) IsTileWalkabke(x, y int) bool

func (*Map) PositionToTile

func (m *Map) PositionToTile(worldPosition engine.Vector) (tile Tile, x, y int)

func (*Map) Start

func (m *Map) Start()

func (*Map) Update

func (m *Map) Update()

type Player

type Player struct {
	Map *Map

func NewPlayer

func NewPlayer() *Player

func (*Player) Start

func (p *Player) Start()

type PlayerController

type PlayerController struct {
	Player          *Player
	Joint           *chipmunk.PivotJoint
	JointGameObject *engine.GameObject
	WalkSpeed       float32

func NewPlayerController

func NewPlayerController(player *Player) *PlayerController

func (*PlayerController) FixedUpdate

func (this *PlayerController) FixedUpdate()

func (*PlayerController) Start

func (this *PlayerController) Start()

type Tile

type Tile int64

func (Tile) Angle

func (t Tile) Angle() float32

func (Tile) Angle2

func (t Tile) Angle2() float32

func (Tile) Collision

func (t Tile) Collision() Tile

func (Tile) LayerConnected

func (t Tile) LayerConnected() bool

func (Tile) SetCollision

func (t Tile) SetCollision(collision Tile) Tile

func (Tile) SetLayerConnection

func (t Tile) SetLayerConnection(on bool) Tile

func (Tile) SetSide

func (t Tile) SetSide(side Tile) Tile

func (Tile) SetSide2

func (t Tile) SetSide2(side Tile) Tile

func (Tile) SetType

func (t Tile) SetType(typ byte) Tile

func (Tile) SetType2

func (t Tile) SetType2(typ2 byte) Tile

func (Tile) Side

func (t Tile) Side() Tile

func (Tile) Side2

func (t Tile) Side2() Tile

func (Tile) Type

func (t Tile) Type() Tile

func (Tile) Type2

func (t Tile) Type2() Tile

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL