Documentation ¶
Index ¶
- Constants
- func Biased(bias int) bool
- func LogError(e error)
- func LogPanic(e error)
- func MouseToRelative(p ICreature, x, y int) (int, int)
- func MoveRandomly() (int, int)
- func MoveToGameObject(m IGameObject, p IGameObject) (int, int)
- func RandomNumber(min int, max int) int
- func UUID() string
- type Config
- type EventManager
- func (em *EventManager) Clear(event string)
- func (em *EventManager) Count() int
- func (em *EventManager) Empty()
- func (em *EventManager) Events() []string
- func (em *EventManager) Fire(event string, params ...interface{}) ([]reflect.Value, error)
- func (em *EventManager) FireBackground(event string, params ...interface{}) (chan []reflect.Value, error)
- func (em *EventManager) HasEvent(event string) bool
- func (em *EventManager) On(event string, function interface{})
- type IBomb
- type IConnection
- type ICreature
- type IGameManager
- type IGameObject
- type IGameObjectMap
- type IHealth
- type IItem
- type IMissle
- type IMonster
- type IPlayer
- type IPortal
- type IRing
- type IRoom
- type IRooms
- type IStrength
- type ITreasure
- type Message
- type Ring
- type Status
Constants ¶
View Source
const ( HOST_IP = "127.0.0.1" PORT_NUM = "1947" NAME = "Player" DIFFICULTY = 30 WORLD_WIDTH = 20 WORLD_HEIGHT = 20 NUM_MONSTERS = 5 NUM_HEALTHS = 10 NUM_STRENGTHS = 10 NUM_TREASURES = 10 NUM_BOMBS = 10 NUM_PORTALS = 10 CAPACITY = 2 VOLUME = 10 DYNAMIC = true )
View Source
const ( MENU_WIDTH = 30 MENU_HEIGHT = 5 MAX_MSGS_DISPLAY = 9 STATUS_LEN = 29 STRENGTH_LOST = -1 )
View Source
const ( AttrBold tb.Attribute = 1 << (iota + 9) AttrUnderline AttrReverse )
View Source
const ( AttrColorDefault tb.Attribute = iota AttrColorBlack AttrColorRed AttrColorGreen AttrColorYellow AttrColorBlue AttrColorMagenta AttrColorCyan AttrColorWhite )
View Source
const ( ColorBlack = AttrColorBlack & ^AttrBold ColorRed = AttrColorRed & ^AttrBold ColorGreen = AttrColorGreen & ^AttrBold ColorYellow = AttrColorYellow & ^AttrBold ColorBlue = AttrColorBlue & ^AttrBold ColorMagenta = AttrColorMagenta & ^AttrBold ColorCyan = AttrColorCyan & ^AttrBold ColorWhite = AttrColorWhite & ^AttrBold )
View Source
const ( BoldColorBlack = AttrColorBlack | AttrBold BoldColorRed = AttrColorRed | AttrBold BoldColorGreen = AttrColorGreen | AttrBold BoldColorYellow = AttrColorYellow | AttrBold BoldColorBlue = AttrColorBlue | AttrBold BoldColorMagenta = AttrColorMagenta | AttrBold BoldColorCyan = AttrColorCyan | AttrBold BoldColorWhite = AttrColorWhite | AttrBold )
Variables ¶
This section is empty.
Functions ¶
func MoveRandomly ¶
func MoveToGameObject ¶
func MoveToGameObject(m IGameObject, p IGameObject) (int, int)
func RandomNumber ¶
Types ¶
type Config ¶
type Config struct { Multiplayer bool Server bool Host string Port string Name string Difficulty int WorldWidth int WorldHeight int Capacity int NumMonsters int NumHealths int NumStrengths int NumTreasures int NumBombs int NumPortals int Volume int Dynamic bool MenuWidth int MenuHeight int NumMsgsDisplay int }
type EventManager ¶
func NewEventManager ¶
func NewEventManager() *EventManager
func (*EventManager) Clear ¶
func (em *EventManager) Clear(event string)
func (*EventManager) Count ¶
func (em *EventManager) Count() int
func (*EventManager) Empty ¶
func (em *EventManager) Empty()
func (*EventManager) Events ¶
func (em *EventManager) Events() []string
func (*EventManager) Fire ¶
func (em *EventManager) Fire(event string, params ...interface{}) ([]reflect.Value, error)
func (*EventManager) FireBackground ¶
func (em *EventManager) FireBackground(event string, params ...interface{}) (chan []reflect.Value, error)
func (*EventManager) HasEvent ¶
func (em *EventManager) HasEvent(event string) bool
func (*EventManager) On ¶
func (em *EventManager) On(event string, function interface{})
type IConnection ¶
type IConnection interface { Run() Count() int }
type ICreature ¶
type ICreature interface { IGameObject Move(bool, int, int) Next(bool, int, int) GetNext() (int, int) Battle(func(ICreature)) ChangeHealth(bool, int) ChangeStrength(bool, int) ChangeTreasure(bool, int) GetHealth() int GetStrength() int GetTreasure() int Dead() bool Stay(bool) Release(bool) Halted() bool LoadRooms(IRooms) }
type IGameManager ¶
type IGameManager interface {
Event(string, ...interface{})
}
type IGameObject ¶
type IGameObject interface { Start(bool) Stop(bool) Run(bool) Running() bool Loop(int, int, func()) Body() Delete(bool) Deleted() bool GetClass() string SetName(bool, string) GetName() string GetSymbol() rune SetColor(tb.Attribute) GetColor() tb.Attribute SetID(bool, string) GetID() string SetPosition(bool, int, int) GetPosition() (int, int) JSON() ([]byte, error) Event(string) *Message }
type IGameObjectMap ¶
type IGameObjectMap interface { Set(string, IGameObject) Get(string) (IGameObject, error) Delete(string) Len() int GetMap() map[string]IGameObject GetKeys() []string GetValues() []IGameObject GetRandomKey() (string, error) GetRandomValue() (IGameObject, error) }
type IItem ¶
type IItem interface { IGameObject GetPoints() int }
type IMonster ¶
type IMonster interface { ICreature Blink() SetPlayer(bool, string) LoadPlayers(IGameObjectMap) LoadPlayer() }
type IRoom ¶
type IRoom interface { HasRoom() bool HasRoomForTwo() bool Enter(bool, IGameObject) Leave(bool, IGameObject) GetCreatures() []ICreature GetHealths() []IHealth GetStrengths() []IStrength GetTreasures() []ITreasure GetGameObjects() []IGameObject }
type IRooms ¶
type IRooms interface { HasRoom(int, int) bool HasRoomForTwo(int, int) bool Enter(bool, int, int, IGameObject) Leave(bool, int, int, IGameObject) GetCreatures(int, int) []ICreature GetHealths(int, int) []IHealth GetStrengths(int, int) []IStrength GetTreasures(int, int) []ITreasure GetGameObjects(int, int) []IGameObject }
type Message ¶
type Message struct { Class string ID string Action string Params map[string]string MultiParams map[string][]string }
func NewMessage ¶
type Ring ¶
func (*Ring) SetCapacity ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.