Duplicate Slice collection

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
Wendigo
Red Slime
Posts: 52
Joined: Tue Feb 28, 2017 1:15 pm

Duplicate Slice collection

Post by Wendigo »

Hi fellow slime,
Is there a way to duplicate a whole slice collection within Hamsterscript?

I'm working on a minigame where the player has to pick associated images out of a set of sprites added to a select slice.
The question and the 5 potential answers should all be one and the same select slice + child sprites.
What I try to achieve is to create 6 copies of the "Answer slice collection" I made in the graphical editor and hook them into the question and answer slots of the "Quiz slice collection" individually.

The only thing I have found is "clone sprite (handle)" which is exactly what I would need, but for the whole collection of answers instead of a single sprite.

These are the slice collections I created in the editor:

Quiz slice collection

Code: Select all

- Panel
-- Sprite (Question slot)
-- Grid
--- Sprite (Answer slot 1)
--- Sprite (Answer slot 2)
--- Sprite (Answer slot 3)
--- Sprite (Answer slot 4)
--- Sprite (Answer slot 5)
Answer slice collection

Code: Select all

- Select
-- Sprite (Slime)
-- Sprite (Hamster)
-- Sprite (And_so_on)
Is there a way to use my premade slice collections or do I need to create (and maintain) the copies manually?
Last edited by Wendigo on Tue Mar 07, 2017 10:56 am, edited 2 times in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Just call "load slice collection" multiple times.

Alternatively, the easiest way to maintain multiple copies in the slice editor might be to delete them and re-duplicate. Unless they aren't positioned in a grid.

Also, "clone sprite" only works for sprite slices, not other types. We ought to add a generic "clone slice" command.

It would be easy to add a command to clone a whole slice tree: it's already implemented, there's just no command to access it. Well, almost: we would need to disallow cloning special/protected slices.
Last edited by TMC on Tue Mar 07, 2017 12:52 pm, edited 2 times in total.
Wendigo
Red Slime
Posts: 52
Joined: Tue Feb 28, 2017 1:15 pm

Post by Wendigo »

Thank you very much, it is working now :)
Post Reply