-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (31 loc) · 958 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
_ "image/png"
"log"
"github.com/hajimehoshi/ebiten/v2"
)
// config
const (
boidCount = 100
width float64 = 1000
height float64 = 1000
maxSpeed float64 = 5
initVelocityScalar float64 = 1 // how fast should the be at the start
margin float64 = 10 // distance from edge to start avoiding edge
cohesionRangeMin float64 = 50
cohesionRangeMax float64 = 100
cohesionForce float64 = 0.001
separationRange float64 = 20
separationForce float64 = 0.08
velocityMatchingRangeMin float64 = 50
velocityMatchingRangeMax float64 = 100
velocityMatchingForce float64 = 0.01
edgeAvoidanceForce float64 = 1
)
func main() {
ebiten.SetWindowSize(int(width), int(height))
ebiten.SetWindowTitle("Boids in go!")
if err := ebiten.RunGame(&Game{}); err != nil {
log.Fatal(err)
}
}