Log In  

Hello! I was wondering if anybody can help me figure out why my code wont delete an object. This is my first time using del so I'm sorry if it is really obvious.

trigger:

function update_slash_p1()

for s in all(slash_p1) do
    s.dx+=1

    if s.dx>8
         then
      kill_slash_p1()
           end
end

code:

function kill_slash_p1()

del(slash_p1,
dx,
frame,
flip,
damage
)

end

I also tried:

del(slash_p1,{
dx,
frame,
flip,
damage
})
end

Thank you!

P#130069 2023-05-23 17:18 ( Edited 2023-05-23 17:54)

Honestly, I wouldn't bother with the kill function (unless it does something else not shown here). I'd just do:

if s.dx > 8 then
  del(slash_p1,s)
end
P#130079 2023-05-23 20:09 ( Edited 2023-05-23 20:10)

Thankyou, I will try that

P#130110 2023-05-24 15:52

It did work, thanks!

P#130113 2023-05-24 15:55

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 16:31:35 | 0.006s | Q:14