(dt float32)
| 342 | } |
| 343 | |
| 344 | func (c *ControlSystem) Update(dt float32) { |
| 345 | for _, e := range c.entities { |
| 346 | speed := engo.GameWidth() * dt |
| 347 | |
| 348 | vert := engo.Input.Axis(e.ControlComponent.Scheme) |
| 349 | e.SpaceComponent.Position.Y += speed * vert.Value() |
| 350 | |
| 351 | var moveThisOne bool |
| 352 | if engo.Input.Mouse.X > engo.WindowWidth()/2 && e.ControlComponent.Scheme == "arrows" { |
| 353 | moveThisOne = true |
| 354 | } else if engo.Input.Mouse.X < engo.WindowWidth()/2 && e.ControlComponent.Scheme == "wasd" { |
| 355 | moveThisOne = true |
| 356 | } |
| 357 | |
| 358 | if moveThisOne { |
| 359 | e.SpaceComponent.Position.Y = c.mouseTrackerMouse.MouseY - e.SpaceComponent.Height/2 |
| 360 | } |
| 361 | |
| 362 | if (e.SpaceComponent.Height + e.SpaceComponent.Position.Y) > engo.GameHeight() { |
| 363 | e.SpaceComponent.Position.Y = engo.GameHeight() - e.SpaceComponent.Height |
| 364 | } else if e.SpaceComponent.Position.Y < 0 { |
| 365 | e.SpaceComponent.Position.Y = 0 |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | type scoreEntity struct { |
| 371 | *ecs.BasicEntity |
nothing calls this directly
no test coverage detected