moving tilemap with sprite? - cocos2d-x

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));

Related

Create Sprite with black details LibGdx

i try generate my sprite and save it for use in app (i wont generate it every render method call). But, if i have black details on my generated sprite it takes transparency. But i wont it...
How i need draw texture on generated sprite?

Drawing Rectangle images-LibGdx

In my first LibGdx Project,I want to draw some rectangles.
I am not looking for shape rendering purpose.I am aiming to implement a function like what fillRect() in j2me do.I have to draw filled rectangles and need to manipulate it(changing size,rotating.. etc).
When I google about it, always getting shapeRenderer related things only.
Please mention how can I draw and manipulate my own images.
Draw Rectangle by using Pixmap.
Texture texture=getPixmapTexture(Color.WHITE);
Sprite sprite=new Sprite(texture); //Used for drawing 2D sprites.
//or
Image image=new Image(texture); //2D scene graph node.
public static Texture getPixmapTexture(Color color){
return new Texture(PixmapBuilder.getPixmapRectangle(1, 1, color));
}
public static Pixmap getPixmapRectangle(int width, int height, Color color){
Pixmap pixmap=new Pixmap(width, height, Pixmap.Format.RGBA8888);
pixmap.setColor(color);
pixmap.fillRectangle(0,0, pixmap.getWidth(), pixmap.getHeight());
return pixmap;
}
The answer by Abhishek is correct.
However, if you have just started game developement with LibGDX, I would check whether you need at all to perform such operation (draw a rectangle).
In libGDX you can use Scene2D which allow you to create a Stage, Actors and direct them on your stage.
So instead of drawing a rectangle, you create an actor, such as an image, to which you can associate a texture, a button or a TextBox and place it on your screen.
Scene2D allows you to then use things like Action or rotation, scaling..
There are some good visual demos about that on Libgdx.info
I am mentioning this because moving to Scene2D later may be more complicated than if you make that decision early on.

How to put a sprite behind other sprites in pygame?

I want to put a sprite on screen, but I want it in the back layer behind other sprites, so that it does not cover up those sprites when they pass by each other.
How would I go about doing this?
One way is to just blit the Surface/Sprite that should go to the background before the other Surface/Sprite that should go to the foreground.
If you use the Sprite class, you could also use the LayeredUpdates or LayeredDirty groups to handle this for you by using a layer attribute or kwarg when adding the Sprite to the group.

libgdx change Image Sprite on runtime

Creating an Image Actor works well if Sprite is passed in Image constructor
Sprite sprite ...
Image image = new Image(sprite);
I need to change the sprite on runtime. But this does not work:
image.setDrawable(new TextureRegionDrawable(newSprite));
Any Idea how to fire the change?
I believe you want to use a TextureRegion for this and just decide which frame to draw: https://github.com/libgdx/libgdx/wiki/2D-Animation

Away3D rotate scene with mouse

I have a simple scene using the Away3D library and the scene display a simple shape. I'm now dealing with Mouse Events trying to get the effect of rotating the 3D object based on the main coordinates system, but i do not get how to get the initial values when mouse is pressed and what to assign when mouse is moving.
Anyone can help me?
Look at the Intermediate Globe example in the Away3D repository. There is an HoverController class that should have all the functionality you need to handle mouse inputs and rotate the camera around your 3D shape.