Check if not colliding with anything

TheLupineOne

  • Posts: 30
How can I have a condition for checking if something is not colliding/overlapping with anything? Right now I have the blocks "this actor didn't hit an actor and  Counter = 0" in the always section (where Counter is an attribute), but it brings up the error

Behavior: Design_0_0_Fill at line 106
Access of undefined property event.
        if((!event.collidedWithActor && sameAs(_Counter, 0)))

Legendary Hoamaru

  • *
  • Posts: 1088
Check this post.  The wording is different but the logic is the same.

I think we may have an article on this but I'm not sure.

coleislazy

  • *
  • Posts: 2607
To expand on this, you are getting those errors because you are trying to place collision-related blocks in a wrapper other than the collision wrapper (in this case, in "always").

Syauqi

  • Posts: 10
To expand on this, you are getting those errors because you are trying to place collision-related blocks in a wrapper other than the collision wrapper (in this case, in "always").

can you explain more? i still don't get it. i have the same problem with "The Lupine One", but still no clue what should i do with it.

coleislazy

  • *
  • Posts: 2607
Blocks from the Collision category can only be used in the "when this collides with something else" wrapper, just like blocks from the Drawing category can only be used in the "when drawing" wrapper. You will get errors if you use them elsewhere.

The post Hoamaru linked gives a very simple solution to the problem posed by the OP.

Syauqi

  • Posts: 10
Blocks from the Collision category can only be used in the "when this collides with something else" wrapper, just like blocks from the Drawing category can only be used in the "when drawing" wrapper. You will get errors if you use them elsewhere.

The post Hoamaru linked gives a very simple solution to the problem posed by the OP.

omg, I'm soo newbie.

I've just realize that I'm mixing up between "always" and "when this collides with something else". It takes me about 10 times reading it, searching it, ended up in this post before I realize it.  :P

Thank you coleislazy.

« Last Edit: January 13, 2012, 06:51:49 am by Syauqi »

Syauqi

  • Posts: 10
coleislazy, another thing to ask.

I still don't really get used with the way stencyl calling actor, tile, terrain, and the way stencyl put it together. i assume that terrain is consists of many tiles sticks together. i want to search it but i dont know what to type.

also the way variable getting used. In the picture below, I have a "Spawm actor Upon Death" variable looks like. what is it? the rules of naming a variable is never use space, more over, i found that many those kind using "?" also. I am confuse, I'm new to stencyl. probably you could gave me link to a post where i could find some answer.

Big Thanks coleislazy.

« Last Edit: January 13, 2012, 07:11:10 am by Syauqi »

Weasel8778

  • Posts: 236
"Spawn actor Upon Death" is the name of a behaviour.

Syauqi

  • Posts: 10
"Spawn actor Upon Death" is the name of a behaviour.

Hi weaslel,

wow, it's true. all of it refer to behavior names. It seems weird, but the behavior seems got a result value... or, is it?

TheLupineOne

  • Posts: 30
Thanks, but it seems that "always" is overriden by "when this collides with something else".

"when this collides with something else" set Not Colliding to false
"always" set Not Colliding to true

Not Colliding always seems to be true.

Am I missing something here? Should I check some settings of my behaviour and objects? I disabled their Physics to allow them to overlap; if they didn't they just collide and can't occupy the same screen space, it's chaotic

coleislazy

  • *
  • Posts: 2607
If physics are disabled for objects, they cannot collide.

TheLupineOne

  • Posts: 30
Yet enabling them means they can't overlap, I want overlap, not objects bumping into each other

Legendary Hoamaru

  • *
  • Posts: 1088
Set the body of the actor's collision box to a sensor.  You can do this by opening an actor, going to the collision tab, then ticking the "Is a Sensor" box for each animation/collision.