Destroy spawned actor

I have actors (coins) spawned just off screen, and they then scroll onto the screen at random intervals and locations.

When my hero collects them, the purse count attribute increases successfully such that his image changes when he's picked up 10 of them, but how do I destroy the coins? I edited the coin prototype and added a rule:

- destroy if it collides with character type hero

but when I set this rule, the coins destroy themselves after they've scrolled about five pixels onto the screen. They show up for just a second and vanish.

Comments

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375
    edited December 2013
    If overlap or collide with object "Hero"
    Change attribute score to score + 1
    Delete coin

    Do you possibly have them destroying when colliding with another actor?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2013
    Or is the image for either your coin actor or hero actor padded with empty space so that the actor is actually larger than the visible image on the scene?

    Post a screenshot of your collision rules (instructions in my signature below) and we'll see if something is amiss.

    Also, put a Log Debugging Statement inside of the collision rule and watch the Debugger window to see if it appears when the coin gets five pixels into the scene. Does it?

    Finally, delete all actors from the scene and re-add them to eliminate the possibility of unlocked instances with their own rules.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.