Open cchandel opened 2 years ago
// mov should be reset every loop
for mov := iterMovement.Begin(); !iterMovement.End(); mov = iterMovement.Next() {
println(mov.Speed, mov.Course)
println(mov.Owner().Entity())
}
//style 1:
for iter := NewIterator(c); !iter.End(); iter.Next() {
v := iter.Val()
fmt.Printf("style 1: %+v\n", v)
}
//style 2:
iter := NewIterator(c)
for c := iter.Begin(); !iter.End(); c = iter.Next() {
fmt.Printf("style 2: %+v\n", c)
}
This works.
for mov := iterMovement.Begin(); !iterMovement.End(); mov = iterMovement.Next()
However, changing the value
mov.Course = 140
does not change the value of course.
movementSystem.go:170: unit id:5 refresh:1s co:45
collection.go:34: collection Add:{"Speed":0,"Course":140}
moveChangeSystem.go:59: unit: 5 course changed: 140
movementSystem.go:170: unit id:5 refresh:1s co:45
Hi, I've setup a world and added 3 Entities with movement component.
I'm trying to use an Input system similar to your example to get and change speed for an entity.
I get 3 values printed - but they're all the same.
+8.888889e-003 +1.450000e+002 -7673762469411480564
+8.888889e-003 +1.450000e+002 -7673762469411480564
+8.888889e-003 +1.450000e+002 -7673762469411480564
How do I get the data for each separate entity?
Thanks.