示例#1
0
func (g *Game) MakeHeatSeeker(pos linear.Vec2, entParams BaseEntParams, hsParams HeatSeekerParams) {
	mine := HeatSeeker{
		BaseEnt: BaseEnt{
			Side_:        10,
			CurrentLevel: GidInvadersStart,
			Position:     pos,
		},
		HeatSeekerParams: hsParams,
	}
	mine.BaseEnt.StatsInst = stats.Make(stats.Base{
		Health: entParams.Health,
		Mass:   entParams.Mass,
		Size:   entParams.Size,
		Acc:    entParams.Acc,
	})
	g.AddEnt(&mine)
}
示例#2
0
// AddPlayers adds numPlayers to the specified side.  In standard game mode side
// should be zero, otherwise it should be between 0 and number of side - 1,
// inclusive.
func (g *Game) AddPlayers(engineIds []int64, side int) []Gid {
	switch {
	case g.Standard != nil:
		if side != 0 {
			base.Error().Fatalf("AddPlayers expects side == 0 for Standard game mode.")
		}
	case g.Moba != nil:
		if side < 0 || side >= len(g.Levels[GidInvadersStart].Room.Starts) {
			base.Error().Fatalf("Got side %d, but this level only supports sides from 0 to %d.", len(g.Levels[GidInvadersStart].Room.Starts)-1)
		}
	default:
		base.Error().Fatalf("Cannot add players without first specifying a game mode.")
	}
	var gids []Gid
	for i, engineId := range engineIds {
		var p PlayerEnt
		p.StatsInst = stats.Make(stats.Base{
			Health: 1000,
			Mass:   750,
			Acc:    1000.0,
			Turn:   0.07,
			Rate:   0.5,
			Size:   12,
			Vision: 600,
		})
		p.CurrentLevel = GidInvadersStart

		// Evenly space the players on a circle around the starting position.
		rot := (linear.Vec2{25, 0}).Rotate(float64(i) * 2 * 3.1415926535 / float64(len(engineIds)))
		p.Position = g.Levels[GidInvadersStart].Room.Starts[side].Add(rot)

		// NEXT: REthing Gids and how the levels are laid out - should they just
		// be indexed by gids?
		p.Side_ = side
		p.Gid = Gid(fmt.Sprintf("Engine:%d", engineId))
		p.Processes = make(map[int]Process)
		p.SetLevel(GidInvadersStart)
		g.AddEnt(&p)
		gids = append(gids, p.Gid)
	}
	return gids
}
示例#3
0
func (g *Game) MakeFrozenThrones() {
	for i, data := range g.Levels[GidInvadersStart].Room.Moba.SideData {
		ft := FrozenThrone{
			BaseEnt: BaseEnt{
				Side_:        i,
				CurrentLevel: GidInvadersStart,
				Position:     data.Base,
			},
			Los: los.Make(LosMaxDist),
		}
		ft.BaseEnt.StatsInst = stats.Make(stats.Base{
			Health: 100000,
			Mass:   1000000,
			Rate:   1,
			Size:   100,
			Vision: 900,
		})
		g.AddEnt(&ft)
	}
}
示例#4
0
func (g *Game) MakeControlPoints() {
	data := g.Levels[GidInvadersStart].Room.Moba.SideData
	neutralData := data[len(data)-1]
	for _, towerPos := range neutralData.Towers {
		cp := ControlPoint{
			BaseEnt: BaseEnt{
				Side_:        -1,
				CurrentLevel: GidInvadersStart,
				Position:     towerPos,
				StatsInst: stats.Make(stats.Base{
					Health: 100000,
					Mass:   1000000,
					Rate:   1,
					Size:   50,
					Vision: 900,
				}),
			},
		}
		g.AddEnt(&cp)
	}
}