Collision based on attribute

Jeffm2Jeffm2 Member, PRO Posts: 102

Ok let me see if i can explain. I wanted to see if there was a way to perform a "do not collide" function based on the alpha of an actor.

I am making a game where you click on a shelf of components bd then a draggable component is spawned. You drag this component to its place on the "circuit" and the hidden actor appears. The draggable is destroyed and the score is upped.

The problem is that if you were to spawn another component and drag it to the same place. the same thing happens where I only want this to happen if the "hidden" actor has an alpha of zero.

The spawned component can be used in a few different places. In the spawned actor are the rules :

if overlaps or collides with actor tag "wire" destroy this actor etc.

in the hidden actor: If alpha is 0 "collide with actor. So is there a way that once this actor has an alpha of 1, the spawned component won't collide and be destroyed, thus telling the player to use it in another appropriate area?

Thanks is advance


  • UltraLionBluUltraLionBlu Member, PRO Posts: 111

    I didn't quite understand what you have to do.

    But the collision can be set based on an actor's alpha.

    for example

    if color alpha is 1


    if color alpha is 0

    collide with

  • Jeffm2Jeffm2 Member, PRO Posts: 102

    Right but you cant set an actor's collision based on another's alpha. The spawned actor is the one that is destroyed when it collided with the "hidden" actor. so the rules exist in the "spawned" actor. but because its a spawned actor, I can't make reference to an actor that exists in the scene already. So i can't say "if other actor's alpha is 0 collide but oof its not don't collide". does that make sense?

  • UltraLionBluUltraLionBlu Member, PRO Posts: 111

    Do you want an invisible actor in the scene who if he collides with the generated actors destroys them?

  • Jeffm2Jeffm2 Member, PRO Posts: 102

    The Generated actor is actually destroyed by the "hidden actor" Its actually like a puzzle in which you drag the piece (generated actor) onto a circuit board. When its in place the generated piece is destroyed leaving the hidden piece revealed. The issue is that if you click on the shelf to create another generated piece (a wire in this case) it can be used somewhere else in the puzzle but if you accidentally put it in the already "revealed" spot. it still gets destroyed. I've attached a couple of images.

    Clicking on the shelf creates a wire that you can drag onto the circuit, destroying the draggable actor but leaving the revealed one giving the impression of it being dropped in place. You could then click on the shelf again to create another draggable wire that is supposed to be put in another spot but if you were to put it in the same place it still gets destroyed because i can't say "if hidden actor alpha is 1, don't collide".

    There may be another way around this, I just cant think of it.

    Thanks for even looking at this BTW. :)

  • UltraLionBluUltraLionBlu Member, PRO Posts: 111

    In the actor begotten

    game add to game add + 1

    in the invisible actor

    if it collides with generated actor

    and game add is 1 destroy

    When you spawn the next actor the attribute will be changed and therefore won't be destroyed

    It should work

  • Jeffm2Jeffm2 Member, PRO Posts: 102

    The hidden is not destroyed, its the generated one. The generated actor is kind of generic as it can, in this case, be placed in any of 6 places. I am having trouble understanding how adding to "game add" works. So if every time an actor is generated and game add is increased, how does the generated get destroyed if it is put in an "empty" spot like it should

  • UltraLionBluUltraLionBlu Member, PRO Posts: 111

    Sorry, I wrote roughly, the "destroy" refers to the generated actor, you can destroy it via an attribute.

    How I believe you already did?

    If you want to send the project, I think I can fix it

  • Jeffm2Jeffm2 Member, PRO Posts: 102

    forgive the mess lol

  • UltraLionBluUltraLionBlu Member, PRO Posts: 111

    I have modified circuit1wire6 and WireDrag.

    If when you start you attack the spawned object at circuit 6 the next spawned object will not destroy itself by touching it

    But I see it will move all the other uahau surely you can work on it and fix it, but I don't have time

    But I hope it can help you!

  • Jeffm2Jeffm2 Member, PRO Posts: 102

    thank you so much

Sign In or Register to comment.