Destroy another actor?

ClanyClany Member Posts: 3

Hi there,

I just started working on my first project, which is supposed to be a very simple click and point escape game.
So far I managed to display a key, which gets "destroyed" when clicked on and gets "spawned" at the bottom (like in an inventory). Also when clicking on the key in the inventory, the image changes to a key with a background, so it appears to be selected (I did that by adding an integer attribute called KeyState and the following rule to the inventorykey: when touch is pressed attribute changes from self.KeyState to 1-self.KeyState. Also I added the rule: when self.KeyState = 0 -> change image to image of key, else Image of selected key.
My plan now was to also spawn a door-actor (which is invisible) when self.Keystate=1, which worked.
But (and here comes the problem), when the Key isn't selected anymore (selfKeystate = 0) I want it to disappear / being destroyed again.
So basically I am looking for a way to destroy the actor door within another actors attributes.
I hope this doesn't sound too confusing but I thought there might be a very simple solution to my problem.
Thanks in advance

Chris

Comments

  • IceboxIcebox Member Posts: 1,485

    @Clany said:
    So basically I am looking for a way to destroy the actor door within another actors attributes.

    I dont really understand what you did , but if you want to destroy an actor based on other actors attribute use game attributes instead of self attributes.
    create game.boolean for example call it killme

    so in actor 1 change game.killme to true , in actor (door) if game.killme is true destroy

  • ClanyClany Member Posts: 3

    You Sir are a genius!
    It worked! Thank you so much!

  • IceboxIcebox Member Posts: 1,485

    @Clany Thanks appreciate your words ! but i am not a genius, i recomend you watch GS logic series it would help you alot understand how everything works in gs, you can find it on youtube wish you the best :)

  • ClanyClany Member Posts: 3

    Oh thats great, I will definetely do that! Thanks again for the help :)

Sign In or Register to comment.