No collision with invisible actors.

As_Of_LatteAs_Of_Latte Member, BASIC Posts: 343

Hey guys,

I have a rule that spawns a random actor every few seconds. The random actors are chosen from a set of 10 images I've made. Out of these 10 images, I have 8 visible actors and 2 "invisible" actors.

I made a separate rule for the "invisible" actors like so;

-When self.image is "Image10.png"
--Change attribute self.Color.Alpha to 0

I've set a behavior that states if random actor collides with hero, game is over.

My question is; If a random "invisible" actor is spawned, how do I turn off the collision behavior with the hero, so that the game can continue?

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    edited January 2015

    I assume your collision rule is set up like this:

    Rule: When overlaps or collides with Hero
     -- game over. 
    

    Add another condition:

    Rule: When overlaps or collides with Hero AND when self.Color.Alpha = 1,
     -- game over. 
    

    Since you're changing the alpha to 0 when it's an invisible image, this new rule will only fire when it collides with the hero actor who's alpha is set to 1.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    edited January 2015

    Make sure the collision rule is in the 'random' actor.
    Then add another condition to the rule:

    When (all)  conditions are valid:  
        Actor Collides or overlaps with actor of type hero  
        Attribute self.Color.Alpha ≠ 0  
            Game Over
    

    Edit: Beat to it by Braydon!

  • SocksSocks London, UK.Member Posts: 12,822

    @AsOfLatte said:
    I have a rule that spawns a random actor every few seconds. The random actors are chosen from a set of 10 images I've made. Out of these 10 images, I have 8 visible actors and 2 "invisible" actors.

    It can get a little confusing when people use 'actor' and 'image' interchangeably (to me at least).

    @AsOfLatte said:
    My question is; If a random "invisible" actor is spawned, how do I turn off the collision behavior with the hero, so that the game can continue?

    If the actor is invisible and does't interact (collide) with the hero then could you not simply delete it ? Or does it have some other function ?

  • As_Of_LatteAs_Of_Latte Member, BASIC Posts: 343

    Thanks @Braydon_SFX‌ and @RThurman‌ that worked!!

    @Socks I apologize if my wording was a little confusing. I'm still trying to get the hang of things, here in the Forums lol :) .

Sign In or Register to comment.