GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Destroy Spawned Instance?

I have a spawn actor for a projectile the player throws every time a button is pressed, I want to destroy only the instances that need destroyed, but I'm unsure how to do this? If I destroy actor all instances are destroyed. Not what I want. Any help?

Comments

  • crazymooseappscrazymooseapps Posts: 30Member, PRO

    Also When The player faces right and fires then turns left and fires all the projectiles fired right suddenly go left!!! Lol I'm baffled

  • tatiangtatiang Posts: 11,490Member, Sous Chef, PRO, Senior Sous-Chef
    edited September 14

    @crazymooseapps said:
    I have a spawn actor for a projectile the player throws every time a button is pressed, I want to destroy only the instances that need destroyed, but I'm unsure how to do this? If I destroy actor all instances are destroyed. Not what I want. Any help?

    It depends what condition you're using for the Destroy behavior.

    @crazymooseapps said:
    Also When The player faces right and fires then turns left and fires all the projectiles fired right suddenly go left!!! Lol I'm baffled

    You'll need to provide the rules you're using for this so that someone can help explain what to fix.

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

  • crazymooseappscrazymooseapps Posts: 30Member, PRO

    I'm not sure what you mean exactly, but I'll try and explain.
    I have a player actor, and when The B button is pushed I use the Spawn actor to spawn his projectile weapon. Rules for when facing left and when facing right to fire in that direction I think it's an instance problem but since they are being created in game I don't know how I can possibly edit them individually

  • tatiangtatiang Posts: 11,490Member, Sous Chef, PRO, Senior Sous-Chef

    What I mean is that there are many ways to make something move or change directions. Without seeing your rules (either typed out or a screenshot), I can't suggest a fix because although you've done something wrong, I don't know what it is...

    It's like if I said "My car is still moving after I step off the brake" but I didn't tell you that I was then putting my foot on the gas pedal or that the car was on a hill the whole time or that it was being pulled by a team of horses... without all of the details, it's just really hard to know what might be causing the issue you described.

    So... what does your Destroy rule look like? Post a screenshot and we'll go from there. And what does your Spawn behavior look like? In particular, the Direction and Relative To settings are going to affect what you described.

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

  • crazymooseappscrazymooseapps Posts: 30Member, PRO

    I figured out the shooting direction problem, what I still cant figure out is how to destroy only the instance of the spawned actor since the player spawns them by pressing the B button.

  • AlchimiaStudiosAlchimiaStudios Posts: 980Member, PRO
    edited September 14

    @crazymooseapps said:
    I figured out the shooting direction problem, what I still cant figure out is how to destroy only the instance of the spawned actor since the player spawns them by pressing the B button.

    Any spawned actor is an individual actor. Actions can happen to each one individually.

    i.e. A destroy when collides rule will only destroy the colliding actor, Not all projectiles on screen even if they are the same base actor.

    If you are using a game level attribute (Game.Attribute) for the destroy rule and it reaches a certain value, then all actors would be destroyed.

    If you are using a self.attribute, it would only apply to one actor at a time as they met the conditions individually.

    If you are using a timer, it would time each actor individually, not as a whole or by the first spawned.

    Follow us: Twitter - Website

  • crazymooseappscrazymooseapps Posts: 30Member, PRO

    Ty!!!! I was able to figure it out based on the info you provided!

Sign In or Register to comment.