| 39 | } |
| 40 | |
| 41 | func (c *ControlSystem) Update(dt float32) { |
| 42 | if engo.Input.Button("moveup").Down() { |
| 43 | c.entity.SpaceComponent.Position.Y -= 5 |
| 44 | } |
| 45 | if engo.Input.Button("movedown").Down() { |
| 46 | c.entity.SpaceComponent.Position.Y += 5 |
| 47 | } |
| 48 | if engo.Input.Button("moveleft").Down() { |
| 49 | c.entity.SpaceComponent.Position.X -= 5 |
| 50 | } |
| 51 | if engo.Input.Button("moveright").Down() { |
| 52 | c.entity.SpaceComponent.Position.X += 5 |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func (game *GameWorld) Preload() { |
| 57 | // A tmx file can be generated from the Tiled Map Editor. |