Delete all but first of a sprites costumes

This deletes all of a sprite costumes
image

and this will delete the 2nd costume

image

so I tried this to delete all but the 1st costume but it doesn't seem to do anything

image

A. Why?
B. Anyone got another method that works

In one of my projects, I remember having the same challenge, i.e. deleting all but the first costume, and I solved it, however I can't say exactly how I did it and which project it was; it should be one of those where an input image is processed and the output image is stored as costume... will look into them...

EDIT
Well, it turned out I only deleted a costume, if there were more than one costumes, which prevented the issue from arising altogether (since there were never more than one of them).

all but first of is a function not a reference. So you end up deleting all items in a new temporary list that you're creating, and that doesn't show anywhere.

Of course :slight_smile:

Sorted with

image

untitled script pic (37)

Does your solution work because inputs are defined (and stored) in advance, so the item 1 is safe despite being deleted before being added back?

Yes
untitled script pic (1)

costumes->[foo]-[bar]-[baz]-[garply]
All but first:

costumes->[foo]-[bar]-[baz]-[garply]
                  ^
                  |
-------------------

Delete it:
costumes->[foo]-[bar]-[baz]-[garply]
--->[null]

Jens reminded Simon of this, but I am sure Simon already knew (just temporarily forgot) it.

here's an easy way

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.