Dynamic change of bounding draw in Cocos2dx - cocos2d-x

How can I change dynamic CC_SPRITE_DEBUG_DRAW in Cocos2dx, or on key pressed show/ hide sprite bounding?

Related

Accessing color of sprite in array - Flash

I have an array of rectangular sprites that are on the stage, each with a different ColorTransform value. I want to be able to click on any one of these rectangles and access the ColorTransform value of this object. What is the best method of accessing whichever rectangle was clicked on?
You can add the same click handler to each rectangle sprite and use event.currentTarget to handle which sprite was clicked: Sprite(event.currentTarget).transform.colorTransform.
Or, if you put all the sprites in the same container, you can add a click handler to the container and use event.target to know which sprite in the container was clicked: Sprite(event.target).transform.colorTransform.

Event Click On MovieClips Mask (Non Transparent Area)

I'm working with Flash CS6 to create MovieClips that I want to use in my AS3 project using Linked Classes, I'm trying to detect when the mouse is clicking the MovieClip, but the event is fired also when I click the transparent area of the PNG image used to create the MovieClip, and I want to fire the event only when I click the non transparent area of the Movieclip (the mask), is there any work around I can do in Flash CS5 or with AS3 code !
You should add an instance name to the mask (which means it must be a symbol), and then add listener directly on the mask, not on the whole movie clip.
Another solution is to set mouseEnabled and mouseChildren to false on that bitmap, and leave only the area you wish to be clickable.

Changing Shape Dynamically Using Mouse In As3

I want to dynamically change the shape of a shape in as3. Say for example, on clicking and dragging on shape square the shape should change according to my mouse movement, direction. I have pasted a link below which display my requirement, selecting one shape and edit edges option, then click the shape and drag, the shape will change according to mouse movent and direction based on some math calculation. Is that possible in AS3.
http://www.shodor.org/interactivate/activities/Tessellate/
Yes, it is possible to make this type of programs.
I suggest you looking into Sprite's graphics object. It has the API to draw primitives, lines and curves.
The reason why you should use Sprites in this case is because it extends InteractiveObject => they support user input, like mouse or touch inputs.
Here's an example of creating triangle:
var s:Sprite = new Sprite();
s.graphics.lineStyle(1, 0x000000); // optional
s.graphics.beginFill(0xff0000); // optional
s.graphics.lineTo(0, 100);
s.graphics.lineTo(100, 100);
s.graphics.lineTo(0, 0);
s.graphics.endFill();
addChild(s);
You can combine mouse events to track input and event ( enter frame in particular ) to redraw your shape depending on the mouse position.
To redraw the shape, you might want to call graphics.clear() method on that object to erase it from the screen.

Its possible do a hole in movieclip with mouse click?

I have a movieclip moving and when I click him I want that appears a hole.
Its possible do that with actionscript? how?
If your hole should appear there the mouse clicks, you could create new Sprite, draw two circles (one bigger than your MovieClip, another at size of you hole, both at position of your click) using his graphics property. Fill it with any color. It should look like donut.
After that assign created Sprite as a mask for your MovieClip.
youMovieClipId.mask=createdSpriteId;
After that, you could add mask as child of your MovieClip, using
youMovieClipId.addChild(createdSpriteId);
Now created mask will follow your MovieClip.

moving tilemap with sprite?

I want to show my tile map portion where my sprite is generate and then move sprite map with sprite movement. How I can achieve this in cocos2dx. I try ccfollow but not get success.
_tileMap->runAction(CCFollow::actionWithTarget(_player));