game

package
v0.0.0-...-af47be6 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2016 License: MIT Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Enemey_Boss = iota
	Enemey_Cookie
)
View Source
const (
	Speed  = Power(2)
	Damage = Power(1)
	Range  = Power(6)
	HP     = Power(5)
)
View Source
const (
	MissleTag = "Missle"
	CookieTag = "Cookie"
)
View Source
const HPGUI_A = 124
View Source
const HP_A = 123
View Source
const Jet_A = 125
View Source
const Missle_A = 334
View Source
const Queen_A = 666
View Source
const ServerIP = "localhost:3123"
View Source
const ServerLocalIP = "localhost:3123"

Variables

View Source
var (
	PowerUpChance       = 2
	PowerUpRepairChance = 5
)
View Source
var (
	GameSceneGeneral *GameScene

	Player     *engine.GameObject
	PlayerShip *ShipController

	Explosion *engine.GameObject
	PowerUpGO *engine.GameObject

	Wall *engine.GameObject

	ArialFont  *engine.Font
	ArialFont2 *engine.Font

	Players map[server.ID]*engine.GameObject = make(map[server.ID]*engine.GameObject)
)
View Source
var Explosion_ID engine.ID
View Source
var PowerUps_ID engine.ID
View Source
var SpaceShip_A = "Ship"

Functions

func CheckError

func CheckError(err error) bool

func Connect

func Connect(name string, errChan *chan error)

func CreatePowerUp

func CreatePowerUp(position engine.Vector)

func LoadTextures

func LoadTextures()

func PowerUpShip

func PowerUpShip(p Power)

func SpawnMainPlayer

func SpawnMainPlayer(spawnPlayer server.SpawnPlayer)

func SpawnPlayer

func SpawnPlayer(spawnPlayer server.SpawnPlayer)

Types

type Background

type Background struct {
	engine.BaseComponent
	// contains filtered or unexported fields
}

func NewBackground

func NewBackground(sprite *engine.Sprite) *Background

func (*Background) Draw

func (sp *Background) Draw()

type Client

type Client struct {
	engine.BaseComponent
	Socket *net.TCPConn
	Name   string
	ID     server.ID
	Ship   *ShipController

	Encoder *gob.Encoder
	Decoder *gob.Decoder

	Jobs         chan func()
	GameJobs     chan func()
	Disconnected bool
	// contains filtered or unexported fields
}
var (
	MyClient     *Client = nil
	LoginErrChan chan error
)

func (*Client) DoJobs

func (c *Client) DoJobs()

func (*Client) HandlePacket

func (c *Client) HandlePacket(packet server.Packet)

func (*Client) LateUpdate

func (c *Client) LateUpdate()

func (*Client) OnPanic

func (c *Client) OnPanic()

func (*Client) Run

func (c *Client) Run()

func (*Client) Send

func (c *Client) Send(p server.Packet)

func (*Client) SendName

func (c *Client) SendName() error

func (*Client) SendRespawn

func (c *Client) SendRespawn() error

func (*Client) Update

func (c *Client) Update()

type DamageDealer

type DamageDealer struct {
	engine.BaseComponent
	Damage float32
}

func NewDamageDealer

func NewDamageDealer(dmg float32) *DamageDealer

type Destoyable

type Destoyable struct {
	engine.BaseComponent
	Alive  bool
	HP     float32
	FullHP float32
	Team   int
	// contains filtered or unexported fields
}

func NewDestoyable

func NewDestoyable(hp float32, team int) *Destoyable

func (*Destoyable) OnCollisionEnter

func (ds *Destoyable) OnCollisionEnter(arbiter engine.Arbiter) bool

func (*Destoyable) SetDestroyTime

func (ds *Destoyable) SetDestroyTime(sec float32)

func (*Destoyable) Start

func (ds *Destoyable) Start()

func (*Destoyable) Update

func (ds *Destoyable) Update()

type DestoyableFuncs

type DestoyableFuncs interface {
	OnDie(byTimer bool)
	OnHit(*engine.GameObject, *DamageDealer)
}

type EnemeyAI

type EnemeyAI struct {
	engine.BaseComponent
	Target *engine.GameObject
	Type   EnemeyType
}

func NewEnemeyAI

func NewEnemeyAI(target *engine.GameObject, typ EnemeyType) *EnemeyAI

func (*EnemeyAI) OnDie

func (sp *EnemeyAI) OnDie(byTimer bool)

func (*EnemeyAI) OnHit

func (sp *EnemeyAI) OnHit(enemey *engine.GameObject, damager *DamageDealer)

func (*EnemeyAI) Start

func (ai *EnemeyAI) Start()

func (*EnemeyAI) Update

func (ai *EnemeyAI) Update()

type EnemeyType

type EnemeyType int

type GameScene

type GameScene struct {
	*engine.SceneData
	Layer1 *engine.GameObject
	Layer2 *engine.GameObject
	Layer3 *engine.GameObject
	Layer4 *engine.GameObject
}

func (*GameScene) Load

func (s *GameScene) Load()

func (*GameScene) New

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

func (*GameScene) OldLoad

func (s *GameScene) OldLoad()

type Missle

type Missle struct {
	engine.BaseComponent
	Speed     float32
	Explosion *engine.GameObject
	// contains filtered or unexported fields
}

func NewMissle

func NewMissle(speed float32) *Missle

func (*Missle) OnComponentAdd

func (ms *Missle) OnComponentAdd()

func (*Missle) OnDie

func (ms *Missle) OnDie(byTimer bool)

func (*Missle) OnHit

func (ms *Missle) OnHit(enemey *engine.GameObject, damager *DamageDealer)

type MouseDebugger

type MouseDebugger struct {
	engine.BaseComponent
}

func NewMouseDebugger

func NewMouseDebugger() *MouseDebugger

func (*MouseDebugger) Update

func (m *MouseDebugger) Update()

type Power

type Power int

type PowerUp

type PowerUp struct {
	engine.BaseComponent
	Type Power
}

func NewPowerUp

func NewPowerUp(typ Power) *PowerUp

func (*PowerUp) OnCollisionEnter

func (pu *PowerUp) OnCollisionEnter(arbiter engine.Arbiter) bool

type ResizeScript

type ResizeScript struct {
	engine.BaseComponent
	MinX, MediumX, MaxX float32
	MinY, MediumY, MaxY float32
	State               int
	Speed               float32
}

func NewResizeScript

func NewResizeScript(minX, mediumX, maxX, minY, mediumY, maxY float32) *ResizeScript

func (*ResizeScript) SetValues

func (m *ResizeScript) SetValues(minX, mediumX, maxX, minY, mediumY, maxY float32)

func (*ResizeScript) Update

func (m *ResizeScript) Update()

type ShipController

type ShipController struct {
	engine.BaseComponent `json:"-"`
	Speed                float32
	RotationSpeed        float32
	Missle               *Missle `json:"-"`
	MisslesPosition      []engine.Vector
	MisslesDirection     [][]engine.Vector
	MissleLevel          int
	MaxMissleLevel       int `json:"-"`

	Destoyable *Destoyable        `json:"-"`
	HPBar      *engine.GameObject `json:"-"`

	UseMouse bool `json:"-"`

	JetFire         *engine.GameObject `json:"-"`
	JetFireParent   *engine.GameObject `json:"-"`
	JetFirePool     []*ResizeScript    `json:"-"`
	JetFirePosition []engine.Vector    `json:"-"`

	FireSource *audio.AudioSource
	// contains filtered or unexported fields
}

func NewShipController

func NewShipController() *ShipController

func (*ShipController) OnComponentAdd

func (sp *ShipController) OnComponentAdd()

func (*ShipController) OnDie

func (sp *ShipController) OnDie(byTimer bool)

func (*ShipController) OnHit

func (sp *ShipController) OnHit(enemey *engine.GameObject, damager *DamageDealer)

func (*ShipController) Shoot

func (sp *ShipController) Shoot()

func (*ShipController) Start

func (sp *ShipController) Start()

func (*ShipController) Update

func (sp *ShipController) Update()

Jump to

Keyboard shortcuts

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