Пример #1
0
func NewGame() *Game {
	e := ein.Init(800, 600)
	player := NewPlayer(e)
	return &Game{
		Engine: e,
		Player: player,
	}
}
Пример #2
0
func NewGame() *Game {
	e := ein.Init(winWidth, winHeight)

	divider := ein.NewRect((ScreenCenterX)-5, 0, 10, winHeight)
	font := ein.LoadFont("Courier New.ttf", 64)
	bat1Label := ein.NewLabel("0", 100, 50, font)
	bat2Label := ein.NewLabel("0", 600, 50, font)

	bat1 := NewBat(10)
	bat2 := NewBat(winWidth - 20)
	ball := NewBall()

	e.AddEntities(ball, bat1, bat2, bat1Label, bat2Label, divider)

	return &Game{
		Engine:    e,
		bat1:      bat1,
		bat2:      bat2,
		ball:      ball,
		bat1Label: bat1Label,
		bat2Label: bat2Label,
	}
}