MCPcopy Index your code
hub / github.com/EngoEngine/engo / Update

Method Update

demos/isoadventure/iso.go:240–261  ·  view source on GitHub ↗
(dt float32)

Source from the content-addressed store, hash-verified

238}
239
240func (s *SpeedSystem) Update(dt float32) {
241 for _, e := range s.entities {
242 speed := engo.GameWidth() * dt
243 prev := e.SpaceComponent.Position
244 e.SpaceComponent.Position.X = e.SpaceComponent.Position.X + speed*e.SpeedComponent.Point.X
245 e.SpaceComponent.Position.Y = e.SpaceComponent.Position.Y + speed*e.SpeedComponent.Point.Y
246
247 var t *common.Tile
248 if e.SpaceComponent.Position.X >= 0 {
249 t = levelData.GetTile(e.SpaceComponent.Center())
250 } else {
251 t = levelData.GetTile(engo.Point{
252 X: e.SpaceComponent.Position.X - float32(levelData.TileWidth),
253 Y: e.SpaceComponent.Position.Y + float32(levelData.TileHeight),
254 })
255 }
256
257 if t == nil {
258 e.SpaceComponent.Position = prev
259 }
260 }
261}
262
263type controlEntity struct {
264 *ecs.BasicEntity

Callers

nothing calls this directly

Calls 3

GameWidthFunction · 0.92
GetTileMethod · 0.80
CenterMethod · 0.80

Tested by

no test coverage detected