Code:
script, erase slice, begin
if (slice collide point (sl, mouse pixel x + camera pixel x + p, mouse pixel y + camera pixel y + q) == true) then(
erasable sl := slice at pixel (sl, mouse pixel x + camera pixel x + p, mouse pixel y + camera pixel y + q)
free slice (erasable sl)
)
end
... ... ...
while (mouse button (left button) == true) do(
if (tool == 0) then(
set slice visible(cursor, on)
sl := load large enemy sprite(a)
set horiz anchor(sl, edge:center)
set vert anchor(sl, edge:center)
update stamp
update cursor
cursor visibility
slice to front(sl)
slice to front(cursor)
)
if (tool == 1) then(
erase slice
set slice visible(cursor, on)
update cursor
cursor visibility
slice to front(cursor)
)
... ... ...
script, erase slice, begin
if (slice collide point (sl, mouse pixel x + camera pixel x + p, mouse pixel y + camera pixel y + q) == true) then(
erasable sl := slice at pixel (sl, mouse pixel x + camera pixel x + p, mouse pixel y + camera pixel y + q)
free slice (erasable sl)
)
end
... ... ...
while (mouse button (left button) == true) do(
if (tool == 0) then(
set slice visible(cursor, on)
sl := load large enemy sprite(a)
set horiz anchor(sl, edge:center)
set vert anchor(sl, edge:center)
update stamp
update cursor
cursor visibility
slice to front(sl)
slice to front(cursor)
)
if (tool == 1) then(
erase slice
set slice visible(cursor, on)
update cursor
cursor visibility
slice to front(cursor)
)
... ... ...
The error I'm getting is when I try to use the eraser tool in the program is "free slice: invalid slice handle 0"
I'm not sure how to prevent this, as far as I can see my code is only supposed to be carried out if a sprite does in fact exist at (x,y) so why does this happen? Not only that but when I do have a slice at position (x,y) I still get this error. It's as if the game does not recognize my slices are there...
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases



