Move savePosition() out of EntrySprite into PlaygroundSystem
This commit is contained in:
@@ -83,6 +83,12 @@
|
||||
pos2 (dictGet (readComponent e2 Positions) _playgroundKey)]
|
||||
(connectionProcessor archive e pos e2 pos2 ui))))))))
|
||||
|
||||
(method savePosition [:Entry e :Float x :Float y &opt :Float z]
|
||||
(withWritableComponents ui.controller.archive e [positions Positions]
|
||||
(let [oldPos (dictGet positions _playgroundKey)]
|
||||
(dictSet positions _playgroundKey
|
||||
(objectWith [z (or z oldPos.z)] x y)))))
|
||||
|
||||
(method defaultPosition [:Entry e]
|
||||
(object x 0.0 y 0.0 z 0.0))
|
||||
|
||||
|
@@ -83,9 +83,7 @@
|
||||
|
||||
(method savePos []
|
||||
(FlxG.camera.extendScrollBounds this PlayState.SCROLL_BOUND_MARGIN)
|
||||
(withWritableComponents archive e [positions Positions]
|
||||
(let [pos (dictGet positions positionKey)]
|
||||
(dictSet positions positionKey (object x (cast this.x Float) y (cast this.y Float) z pos.z)))))
|
||||
(system.savePosition e (cast this.x Float) (cast this.y Float)))
|
||||
|
||||
(method &override :Void update [:Float elapsed]
|
||||
(super.update elapsed)
|
||||
|
Reference in New Issue
Block a user