Page 1 of 1

Changing parent of mobile_obj to Scrollmap

Posted: 05 August 2025, 07:08
by Sydnique
There is a game component (a hexagonal playing tile) which starts on a players hand and has to move to an absolute position onto the scrollmap.
I've tried different things, but hopefully anybody knows a better way?

Version a)
- put mobile_obj on scrollmap with this.attachToNewParent
- slide mobile_obj into position with this.slideToObject
Result: The mobile_obj jumps under it's parent (becoming invisible), then moves to it's target position. (reappearing from under the "player hand")

I hope you can see how the blue tile is invisible for just a split second in this demo:
Image


Version b)
- scrollmap.disableScrolling()
- slide mobile_obj into position with this.slideToObject
- put mobile_obj on scrollmap with this.attachToNewParent
- scrollmap.enableScrolling()
Result: It looks good, but I'm not sure if there is a better way.

Also this gives me an exception:
Uncaught (in promise) ReferenceError: sdojo is not defined


By the way, this is what Version b) looks like without disabling the scrollmap:
- Tile stays correctly above the player hand
- But it doesn't land on the correct position
Image



I've also messed around with z-Index and position:relative without any noticable effect.
This is happening in the currently developed game bainewedlockpowerplants if you want to see for yourself.