Preventing collision "When Created"? attribute not registering

infinitum3d

  • Posts: 89
I'm trying to create an actor (a dog) under another actor (a doghouse) and I want the dog to be able to leave the doghouse to fetch a bone and come back and kill the actor (the dog) on Collison with the doghouse.

"When creating" the dog,  I set a boolen attribute (isReturning?) = false.

When the dog collides with the bone, I set 'isReturning=true'.

The scene has a collision between groups event;
when dog hits doghouse
if isReturning?= true
kill actor 1
increment numberBones

the problem is, it kills Actor 1 and increments the bones immediately. It's like the 'isReturning?' Attribute is set as true by default.

Any suggestions on why or how this is happening and/or what I can do to correct it?

Thanks!

colburt187

  • *
  • Posts: 2416
do you have your boolean set to false by default, you shouldn't have to set it.

also try drawing the boolean on the screen so you can see whats happening, just drop it into a drawing block. Is the dog house a sensor? so the dog can pass through it when created?

make sure the house and bone are different collision groups also.


sdieters

  • Posts: 2068
try doing something like this:

instead of the doghouse being a sensor, use a region. im also not sure why you want to kill the dog after each fetched bone. cant you simply change the animation?

but anyway, first remove the collision box from the doghouse and remove the events attached to it.

create a region in the same place of the doghouse and use the following event (inside a behaviour since you need to assign the region in the scene editor) and attach it to the dog.

when (self) leaves (region) << cant remember the actual name of the block. im not home atm.
set isReturning to false

this way you can leave the doghouse as an actor (or even a tile) without a collision model and place it a layer above the dog itself. i hope you know where i am going if not, let me know =)

My new profile is TheIndieStation.
When you see a recent post with this name, i'm probably using my phone. So dont mind any typo's =p

infinitum3d

  • Posts: 89
Quote
im also not sure why you want to kill the dog after each fetched bone. cant you simply change the animation?

the reason is there are different types of dogs for different purposes. When one type fetches a bone they get a certain reward. When a different type is sent, different events occur.

How is using a region any different than using an actor? If the dog starts in the region isn't the collision with the region going to occur instantly just like it would with an actor?

Thanks for the help. I guess I just don't understand.

infinitum3d

  • Posts: 89
do you have your boolean set to false by default, you shouldn't have to set it.



Ah. I'll check that. Thanks!