Stock Item with div instead of images.

Game development with Board Game Arena Studio
Post Reply
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Stock Item with div instead of images.

Post by RicardoRix »

Hi.

I am looking for the functionality of the stock item, like the animation effects of adding, removing items, etc. but I want to do this with div's rather than images.
I have a container div with lots of things inside it, including an image, some tokens and 2 other stock items.
And players each have a list of these container types on their player boards.

I would like the ability to move the whole container around as one object between players, the same as cards normally move around in other games.

I know I can move it around with slideTo... but I'm also looking for removing/inserting to DOM and the nice animation effects.
User avatar
paramesis
Posts: 398
Joined: 28 April 2020, 05:00

Re: Stock Item with div instead of images.

Post by paramesis »

It sounds like your best option would be a Zone.
The placeInZone method includes an animation like slideTo..., and I've used it for a case similar to what you're describing.

If you really need to use the selection capability of a stock, you could inject html into the stock items after adding them. I did this for the cart selection/change speed palette in Off the Rails, but the stock items never move after the interface is loaded, so this probably wouldn't work in your case.
User avatar
Brainchild
Posts: 71
Joined: 31 January 2014, 19:42

Re: Stock Item with div instead of images.

Post by Brainchild »

Absolutely, use Stock component with the onItemCreate callback to insert your div. I wrote an example in this thread about resizing stock items.
Post Reply

Return to “Developers”