Chapter 5: Tileset, Tilemap, and Camera

https://leanpub.com/gameprogramminggolang

Technical requirements

https://leanpub.com/gameprogramminggolang

Tileset - cutting tiles from a spritesheet

https://leanpub.com/gameprogramminggolang

What is a tile?

https://leanpub.com/gameprogramminggolang

What is a spritesheet?

https://leanpub.com/gameprogramminggolang

Identify the floor tiles

https://leanpub.com/gameprogramminggolang

Convert a tile cell into pixels

https://leanpub.com/gameprogramminggolang

The Tileset struct

https://leanpub.com/gameprogramminggolang

Cutting out one tile with GetTileRect

https://leanpub.com/gameprogramminggolang

Tilemap - from a finite pattern to an infinite floor

https://leanpub.com/gameprogramminggolang

A tilemap is a grid of choices

https://leanpub.com/gameprogramminggolang

Store the tilemap in floor.map

https://leanpub.com/gameprogramminggolang

Map text numbers to tileset cells

https://leanpub.com/gameprogramminggolang

Parse the text file into Go data

https://leanpub.com/gameprogramminggolang

Place tilemap cells in world space

https://leanpub.com/gameprogramminggolang

Load the finite pattern during setup

https://leanpub.com/gameprogramminggolang

Repeat the finite pattern forever

https://leanpub.com/gameprogramminggolang

Draw only the visible cells

https://leanpub.com/gameprogramminggolang

Camera - the moving window over the world

https://leanpub.com/gameprogramminggolang

Why you need a camera

https://leanpub.com/gameprogramminggolang

World space vs screen space

https://leanpub.com/gameprogramminggolang

The Camera struct

https://leanpub.com/gameprogramminggolang

Make the camera follow the player

https://leanpub.com/gameprogramminggolang

Apply the camera offset

https://leanpub.com/gameprogramminggolang

World - orchestrating the render pass

https://leanpub.com/gameprogramminggolang

The World.Draw sequence

https://leanpub.com/gameprogramminggolang

Prepare the draw surface

https://leanpub.com/gameprogramminggolang

Queue drawables with the camera offset

https://leanpub.com/gameprogramminggolang

Chapter 5 setup - file by file

https://leanpub.com/gameprogramminggolang

cmd/main.go - program entry point

https://leanpub.com/gameprogramminggolang

run.go - starting Ebitengine

https://leanpub.com/gameprogramminggolang

game.go - creating the session

https://leanpub.com/gameprogramminggolang

game_init.go - loading textures and creating the tilemap

https://leanpub.com/gameprogramminggolang

player.go - player movement in world space

https://leanpub.com/gameprogramminggolang

settings.go - shared configuration

https://leanpub.com/gameprogramminggolang

Embedded assets

https://leanpub.com/gameprogramminggolang

Optional extensions

https://leanpub.com/gameprogramminggolang

Smooth camera following

https://leanpub.com/gameprogramminggolang

Multiple tilemap layers

https://leanpub.com/gameprogramminggolang

Different patterns

https://leanpub.com/gameprogramminggolang

Running the chapter

https://leanpub.com/gameprogramminggolang

Summary

https://leanpub.com/gameprogramminggolang