Monday, June 6, 2022
HomeGame DevelopmentCocos creator contact occasion - Cocos Creator

Cocos creator contact occasion – Cocos Creator


hey, how i can transfer node(sprite) like cocos 2dx in cocos creator dynamically.(needed to know contact started ,contact transfer and contact finish occasion ) in cocos creator.


https://docs.cocos.com/creator/handbook/en/scripting/internal-events.html

For instance:

this.node.on(cc.Node.EventType.TOUCH_MOVE, (ev: cc.Occasion.EventTouch) => {

}, this);

hello thanks in your response. is that this work for 3.4.2?? i’ve did that means. but it surely isn’t working.
begin () {

    //this.node.on(Node.EventType.TOUCH_MOVE, this.onEventMove,this);

  }

onEventMove(even)
{
console.log(“began”);
let worldPoint1 = even.getLocation();

}

i can capable of get coordinator easily however how i can straight transfer the nods?? if i used to be cross straight coordinator to any node then place of node straight get out of display. didn’t get precise contact location… (observe – node added straight in canvas)

this.node.setPosition(worldPoint1.x, worldPoint1.y);

that is working however contact of any node i used to be getting from far distance… as a result of convertToNodeSpace not working in 3.4.2. might you please assist me to resolve this difficulty.if there will probably be any instance then please might you capable of put up right here.

You may get the UITransform first, then use convertToNodeSpace in v3.4.2.

@linrm are you able to please give me instance for that i didn’t capable of get you. sorry for delayed in response i’m in another work.

this.touchNode.getComponent(UITransform).convertToNodeSpaceAR(level); seek advice from :CocosCreatorAPI

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments