(dt float32)
| 307 | } |
| 308 | |
| 309 | func (c *ControlSystem) Update(dt float32) { |
| 310 | for _, e := range c.entities { |
| 311 | speed := 800 * dt |
| 312 | |
| 313 | vert := engo.Input.Axis(engo.DefaultVerticalAxis) |
| 314 | e.SpaceComponent.Position.Y += speed * vert.Value() |
| 315 | |
| 316 | if (e.SpaceComponent.Height + e.SpaceComponent.Position.Y) > 800 { |
| 317 | e.SpaceComponent.Position.Y = 800 |
| 318 | } else if e.SpaceComponent.Position.Y < 0 { |
| 319 | e.SpaceComponent.Position.Y = 0 |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | type scoreEntity struct { |
| 325 | *ecs.BasicEntity |