Author Topic: RemoveSprite  (Read 5313 times)

Mcgooter

  • Visitor
  • *
  • Posts: 1
    • View Profile
RemoveSprite
« on: 2006-02-23, 04:06:50 PM »
I haven't a clue about code and scripting.  I've tried to read through the docutorial a couple times, yet it all seems foreign and full of gibberish to me.  I just want to be able to remove a sprite after a certain frame number.  Here's what I got.

Code: [Select]
Dim nIdx
   With  ProjectObj.GamePlayer.PlayerSprite.rDef.rLayer
     For nIdx = 0 to .SpriteCount - 1
       If .Sprite(nIdx) Is .Sprite = "Guard1" Then
       .RemoveSprite(nIdx)
     End If
     Next
   End With

Can anyone send some info my way to how I could accomplish this correctly?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: RemoveSprite
« Reply #1 on: 2006-02-23, 04:54:19 PM »
Have you considered doing this without scripting by putting the sprite on a path and having it delete itself at the end of the path?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: RemoveSprite
« Reply #2 on: 2006-02-23, 05:44:45 PM »
Take a look here for the "official" equation for exactly how long a sprite animation is.  Then, create a path with just one point and one delay equal to the length of the animation, and have it auto-delete at end of path.
Edward Dassmesser