gameisometric

package
v0.0.0-...-ce97658 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

gameisometric

This is a simple isometric 'game' experiment using the ebitengine and is written in Go. The code is heavily inspired by the ebiten isometric example. I modified the code to use gendungeon for level generation instead of just randomly place tiles.

alt text

Some interesting info on the math behind isometric maths can be found here: https://clintbellanger.net/articles/isometric_math/

NOTE

Part of (or All) the graphic tiles used in this program is the public domain roguelike tileset 'RLTiles'. You can find the original tileset at: http://rltiles.sf.net

See: https://opengameart.org/content/dungeon-crawl-32x32-tiles

Further, I am using Kenney's fantastic isometric tile set.

See: https://www.kenney.nl/assets/isometric-miniature-library

TODO

  • Add basic isometric rendering
  • Use gendungeon for level generation
    • Add multilevel dungeon generation
    • Add stairs
    • Add doors
    • Add furniture
    • Tidy up level handling
    • Add clutter generation
  • Add actual game
    • Add player and player movement
    • Add enemies
    • Add combat
    • Add items
    • Make stairs and doors functional

Documentation

Overview

Copyright 2021 The Ebiten Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed tiles/64x64.png
	Spritesheet_png []byte

	//go:embed tiles/kenney/longTable_N.png
	TableN_png []byte

	//go:embed tiles/kenney/longTable_E.png
	TableE_png []byte

	//go:embed tiles/kenney/longTable_S.png
	TableS_png []byte

	//go:embed tiles/kenney/longTable_W.png
	TableW_png []byte

	//go:embed tiles/kenney/displayCase_N.png
	DisplayCaseN_png []byte

	//go:embed tiles/kenney/displayCase_E.png
	DisplayCaseE_png []byte

	//go:embed tiles/kenney/displayCase_S.png
	DisplayCaseS_png []byte

	//go:embed tiles/kenney/displayCase_W.png
	DisplayCaseW_png []byte

	//go:embed tiles/kenney/bookcaseBooks_N.png
	BookcaseBooksN_png []byte

	//go:embed tiles/kenney/bookcaseBooks_E.png
	BookcaseBooksE_png []byte

	//go:embed tiles/kenney/bookcaseBooks_S.png
	BookcaseBooksS_png []byte

	//go:embed tiles/kenney/bookcaseBooks_W.png
	BookcaseBooksW_png []byte
)

Functions

func ReadImage

func ReadImage(data []byte) *ebiten.Image

ReadImage reads an image from a byte slice and downscales it to the tile size.

Types

type Direction

type Direction int
const (
	DirectionNone  Direction = 0
	DirectionNorth Direction = 1 << iota
	DirectionSouth
	DirectionEast
	DirectionWest
)

type Game

type Game struct {
	// contains filtered or unexported fields
}

Game is an isometric demo game.

func NewGame

func NewGame() (*Game, error)

NewGame returns a new isometric demo Game.

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

Draw draws the Game on the screen.

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int)

Layout is called when the Game's layout changes.

func (*Game) Update

func (g *Game) Update() error

Update reads current user input and updates the Game state.

type Level

type Level struct {
	// contains filtered or unexported fields
}

Level represents a Game level.

func NewLevel

func NewLevel() (*Level, error)

NewLevel returns a new randomly generated Level.

func (*Level) LevelDown

func (l *Level) LevelDown()

LevelDown moves the player down one level.

func (*Level) LevelUp

func (l *Level) LevelUp()

LevelUp moves the player up one level.

func (*Level) LoadLevel

func (l *Level) LoadLevel()

LoadLevel loads the current level from the dungeon.

func (*Level) Size

func (l *Level) Size() (int, int)

Size returns the size of the Level.

func (*Level) Tile

func (l *Level) Tile(x, y int) *Tile

Tile returns the tile at the provided coordinates, or nil.

type Sprite

type Sprite struct {
	N, E, S, W *ebiten.Image
}

func NewSprite

func NewSprite(n, e, s, w *ebiten.Image) *Sprite

type SpriteSheet

type SpriteSheet struct {
	Floor       *ebiten.Image
	Wall        *ebiten.Image
	StairsUp    *ebiten.Image
	StairsDown  *ebiten.Image
	DoorNS      *ebiten.Image
	DoorEW      *ebiten.Image
	DoorNSOpen  *ebiten.Image
	DoorEWOpen  *ebiten.Image
	Table       *Sprite
	DisplayCase *Sprite
	Bookcase    *Sprite
}

SpriteSheet represents a collection of sprite images.

func LoadSpriteSheet

func LoadSpriteSheet(tileSize int) (*SpriteSheet, error)

LoadSpriteSheet loads the embedded SpriteSheet.

type Tile

type Tile struct {
	// contains filtered or unexported fields
}

Tile represents a space with an x,y coordinate within a Level. Any number of sprites may be added to a Tile.

func (*Tile) AddSprite

func (t *Tile) AddSprite(s *ebiten.Image)

AddSprite adds a sprite to the Tile.

func (*Tile) Draw

func (t *Tile) Draw(screen *ebiten.Image, options *ebiten.DrawImageOptions)

Draw draws the Tile on the screen using the provided options.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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