I have a Balloon class (see this) that inherits from CCSprite. I have given it properties like balloonSpeed and balloonStrength. I seem to be having problems in it, though.
What I want to do is that when I make an instance of the Balloon class, I want it to do the following:
- Give it a texture (a PNG file of a balloon).
- Set properties like
balloonSpeedandballoonStrength. - Add actions to make it move and accept touch input.
When the object is touched, I want to:
- Count if # of taps =
balloonStrength. if so, destroy Balloon.
I have done a simpler version of this where a Balloon object is destroyed when it is touched. I want to apply OOP and custom classes here but I can’t seem to get the right way of doing it.
Thanks in advance.
then the h file should looks like below:
and in your touch method:
you can use it after you add the blueBalloon as a child of a layer or node as below: