removeFromZone and slideToObject not working during js setup?

Game development with Board Game Arena Studio
Post Reply
User avatar
CuriousTerran
Posts: 21
Joined: 12 July 2020, 21:03

removeFromZone and slideToObject not working during js setup?

Post by CuriousTerran »

During the game, I am able to use functions like removeFromZone and slideToObject in the notifications to move elements around without issues. However, when I try to implement removeFromZone and slideToObject inside the initial js setup, the elements do not move to the other elements. For instance a call in the setup like zone_obj.removeFromZone(<zone_id>, false, <other_id>);
will result in <zone_id> element staying in the zone parent, but overlapping with the other markers. Calling this.slideToObject().play() or trying to directly place element with this.placeOnObjectPos(), do not work in the js setup function either.
So, I am stumped. In the js setup I can create stock, zone, etc. objects add objects to them without problems. I have triple checked the id s of elements are correct and found the elements with I want to move and their location in the chrome debugging element review.

Any ideas about moving items in the js setup as opposed to other states of the game? Thank you for any suggestions.
User avatar
Quinarbre
Posts: 140
Joined: 15 December 2013, 23:26

Re: removeFromZone and slideToObject not working during js setup?

Post by Quinarbre »

I think I have stumbled upon the same kind of issue : setup occurs before history is loaded, and that latter step messes a bit some coordinates, making slideToObject or placeOnObject ineffective.

One workaround is to create (in your template) a specific div on the target location precisely where you want the objects to be placed (that div will be correctly placed by your css), and then have your objects appear in that div.
User avatar
CuriousTerran
Posts: 21
Joined: 12 July 2020, 21:03

Re: removeFromZone and slideToObject not working during js setup?

Post by CuriousTerran »

Thank you for that suggestion. I will give that a try.
Post Reply

Return to “Developers”