示例#1
0
文件: fx.go 项目: rsaarelm/teratogen
// Blast generates an explosion effect in the game world.
func (f *Fx) Blast(loc space.Location, kind BlastKind) {
	switch kind {
	case SmallExplosion:
		frames := anim.NewCycle(.1e9, false, util.SmallIcons(util.Items, 32, 33, 34, 35))
		f.anim.Add(
			anim.Func(func(t int64, offset image.Point) {
				frames.Frame(t).Draw(offset)
			}), space.SimpleFootprint(loc), .4e9)
	case LargeExplosion:
		frames := anim.NewCycle(.10e9, false, util.LargeIcons(util.Items, 5, 6, 7, 8, 9))
		f.anim.Add(
			anim.Func(func(t int64, offset image.Point) {
				frames.Frame(t).Draw(offset)
			}), space.SimpleFootprint(loc), .5e9)
	case Sparks:
		frames := anim.NewCycle(.07e9, false, util.SmallIcons(util.Items, 36, 37, 38))
		f.anim.Add(
			anim.Func(func(t int64, offset image.Point) {
				frames.Frame(t).Draw(offset)
			}), space.SimpleFootprint(loc), .21e9)
	case BloodSquib:
		frames := anim.NewCycle(.07e9, false, util.SmallIcons(util.Items, 39, 40, 41))
		f.anim.Add(
			anim.Func(func(t int64, offset image.Point) {
				frames.Frame(t).Draw(offset)
			}), space.SimpleFootprint(loc), .21e9)
	case Smoke:
		frames := anim.NewCycle(.07e9, false, util.SmallIcons(util.Items, 42, 43, 44))
		f.anim.Add(
			anim.Func(func(t int64, offset image.Point) {
				frames.Frame(t).Draw(offset)
			}), space.SimpleFootprint(loc), .21e9)
	default:
		println("Unknown blast kind ", kind)
		return
	}

}
示例#2
0
	VoidTerrain Terrain = iota
	FloorTerrain
	WallTerrain
	DoorTerrain
	StairTerrain

	BarrelTerrain
	ShelfTerrain
	ChairTerrain
	CounterTerrain
	PlantTerrain
)

func GetTerrainData(t Terrain) TerrainData {
	return terrainTable[t]
}

var terrainTable = []TerrainData{
	{util.SmallIcons(util.Tiles, 3), SolidKind}, // void terrain, should have some "you shouldn't be seeing this" icon
	{util.IsoIcons(util.Tiles, 5), OpenKind},
	{util.IsoIcons(util.Tiles, 1, 2, 3, 4), WallKind},
	{util.IsoIcons(util.Tiles, 7, 8, 9, 7), DoorKind},
	{util.IsoIcons(util.Tiles, 6), OpenKind},

	{util.IsoIcons(util.Tiles, 10), ObstacleKind},
	{util.IsoIcons(util.Tiles, 11), GrillKind},
	{util.IsoIcons(util.Tiles, 12), OpenKind},
	{util.IsoIcons(util.Tiles, 13), GrillKind},
	{util.IsoIcons(util.Tiles, 14), OpenKind},
}