Libgdx: Remove white space in a sprite - libgdx

I recently started using Libgdx for the first time and I'm trying to make a 2D game similar to Zelda/Pokemon.
The problem I'm having is that I don't know how to make the sprite blend with the background (a tiled map .tmx file). I tried using enableBlending() but it doesn't work. I want the white space around the sprite to be removed so that the tiled map background shows.
tiled map with the sprite
Thanks

Blending is not required in your case.
Just use .png(having transparent background) file instead of .jpg(having white background).

Related

Libgdx, sprite batch and setColor to specific region

So I have a simple texture: one big green circle in the center and one small white circle also in the center of my texture. And now I want to change color of my white circle to yellow in my app. Is it possible and what is the best way to set color of my batch for specific region? I saw it is possible in other engines using the second texture with marked region which color will be changed.
Like that:
http://s9.postimg.org/qh7bbu5an/FINAL.png
My original texture
2nd texture with region which color i want to change
The result of my texture in app which will be working like batch.setcolor but only for specific region (pixels) in my texture
If you are looking for an example of masking textures together, you can check this tutorial.
https://github.com/mattdesl/lwjgl-basics/wiki/ShaderLesson4
It also has a port to libGDX.

Can I overlap a sprite or a layer on video in Cocos2d-x?

In Cocos2d-x's sample code cpp-tests, there is a UIVideoPlayer sample in android platform.
I change the video's position to (0,0) and even add a layer(or a sprite) overlapped on it, the video just can't be covered any way(video playing is fine), even the FPS and the vertex count info are the same.
Is it normal? Nothing can overlaps the video? If not, how can I overlap my sprite(or layer) on it?
By default, all non-cocos2d views are on top of everything drawn by cocos2d.
You can only add the video in the background, with cocos2d drawing everything on top.
What you can not do is to have a cocos2d node drawn in the background, draw the video over it, then draw another cocos2d node on top of the video. The reason is simple: cocos2d draws everything to its own view, and there's only one cocos2d view. So you can only change the draw order of everything drawn by cocos2d with some other view, since nodes aren't views themselves.

Actionscript: Make a mask follow a line (and "grow")

does anybody know/have some idea how to make a mask follow a line? Basically I have a drawing made with 1px line and I need to gradually mask this shape so it actually looks like it is being drawn. The thing is that I cannot just increase the width of the mask (it would simple draw a vertical line in one step which is not desired), it has to be a linear movement along the "guide" line, so the vertical line gets drawn in several steps. Doing this manually will/would be a major pain. This is what I am trying to achieve:
Thanks a lot!
You have to do it manually. Though there are some shortcuts you can take:
Create a Guide layer in Flash Pro.
Copy a vector of your path to this guide layer.
Create a new layer below it, put a circle on that layer at the start of the path and make a classic tween of that circle.
Dock your circle layer under your guide layer and at the last frame of your tween move the circle to the end of the path. This will make the circle go along the path.
Follow the animation and manually fill the covered parts.
Put your guide, circle animation and following animation into a MovieClip and put it above your to be masked symbol and make its layer a mask.
Here's an example I made for you if I wasn't clear enough: http://db.tt/kvaaYaLA
Note that this method is only useful if you need a static animation, not for a dynamic one.

Drawing the exact region of the Bitmap in as3

I am working on a Action Script 3.0 application , in which i ill be allowed to load the image and make them draggable. Consider i am loading the deer image and making it as draggable.
Problem with this is , if i click on the translucent area ( white space around the bitmap ), i dont want the bitmap to draggable.is there any way to draw the deer boundary region exactly without the white space around it.
You can use BitmapData methods to get each pixel color, and then, you can either :
On creation, for each pixel if it's not fully transparent (!= 0) you can draw a point of a Shape, which will be transparent, and make it dragable in place of your bitmap (as noticed in comment, it will be quite CPU consuming, so use the second method)
On click, get the click coordinate relative to the bitmap, check if the pixel is transparent and make it drag only if it's not.
In either way, that will be quite CPU consuming. You may also consider convert your bitmap to a vector image (Sprite). This will allow flash to detect real images boundaries.

how to load image dynamically in Flash actionscript3?

I want to load the image dynamically in Flash actionscript, like this :
When the user select the image it should contain inside the frame instead of black plane box. I am thinking If I can apply that image as background image for that black plane box (which I draw separately inside the frame) that would be great. Because over here the issue is the image should look like 3D inside the frame, so maybe the background or texture method will solve this problem. Please friends give me suggestion...
Thanks.