Handling touch events of multiple subclassed sprites in a scene

Cocos2d-x v3
  • pabitrapadhy
    Likes 0

    Problem Description

    Hello

    I would need your help regarding some touch events.
    Say, I have 3 subclasses sprite classes – 

    Shop
    Customer
    Staff

    something like that, and all these classes are subclass of Sprite class.

    For handling touch on these different sprites, I am using seperate touch listeners in each source file of these classes.
    So, 3 touch began 3 touch ended like such, which I am not sure is an optimal way or not.

    Is there any optimal way of using these events ?

    Also, when you are passing this as target, then what does that mean.. !!
    As I guess the touch events are targetted for the object of the class where the listener is intended to.

    Could you clarify this a little bit.

    Thanks in advance.

    Regards

  • Sonar Systems admin
    Likes 0

    Performance wise this shouldn’t be an issue.

     

    Check this out for more information on this→ http://www.tutorialspoint.com/cplusplus/cpp_this_pointer.htm

     

  • pabitrapadhy
    Likes 0

    No, I mean clarification regarding different touch event and touch listeners for different classes.

    I am clear about this

  • Sonar Systems admin
    Likes 0

    What sort of clarification do you need on what?

Login to reply