Exemplo n.º 1
0
func NewTile(kind TileKind, w *World, x, y int) Tile {
	return Tile{
		Kind:     kind,
		W:        w,
		X:        x,
		Y:        y,
		Entities: *NewEntitySet(),
		aabb: d2.Rect(
			(float32(x)-0.5)/w.GridScale,
			(float32(y)-0.5)/w.GridScale,
			(float32(x)+0.5)/w.GridScale,
			(float32(y)+0.5)/w.GridScale,
		),
	}
}
Exemplo n.º 2
0
func (cm *CoffeeMachine) Rectangle() d2.Rectangle {
	x, y := cm.pos[0], cm.pos[1]
	return d2.Rect(x-0.25, y-0.25, x+0.25, y+0.25)
}
Exemplo n.º 3
0
func (bb *BuildingBase) Rectangle() d2.Rectangle {
	x, y := bb.pos.X(), bb.pos.Y()
	return d2.Rect(x-0.25, y-0.25, x+0.25, y+0.25)
}