Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17070

BoxCollider, cc.Prefab, Tag question

$
0
0

@luke2125 wrote:

Hi,

I created a Prefab with a BoxCollider and Tag = 1, I also set the Prefab under the group to zombie and then went to Project - > Project Settings, and checked the Group Collide Map for the zombie to collide with player. Now, I'm trying for the player to collider / recognize as per Tag = 1, and it's not detecting and reducing player's health, please see below:

collideleftzombiemoveright:cc.Prefab
var boxcollider = this.collideleftzombiemoveright.getComponent(cc.BoxCollider);
this.node.color = cc.Color.RED;
this.touchingNumber ++;
if(boxcollider.tag === 1){
this.healthbarscore.progress -= 0.10}

Any help will be appreciated it......Thanks and God Bless....

Sincerely,

Sunday

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17070


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>