I'm a newbie at libgdx and trying to achieve a border less arc like first image with shaperenderer.
http://i.stack.imgur.com/41CUu.png
But It draws this
http://i.stack.imgur.com/Q5Ftg.png
My small line of code is ;
shapeRenderer.arc(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2,300,0,170);
How can manage to create an arc without borders. I will need to change angle range of the arc. So I cannot use a static image or sth like that.
Thanks
Related
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).
It has been a few since a started playing with LibGDX.
Now I am tryin g to drag and drop bodies onto slots of the same shape:
E.g. Squares can only be dropped onto squares of the same size or bigger. The same for triangles and circles.
https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/DragAndDropTest.java
My point of start is the sample above, but I have no idea put everything together.
1 - What would be the easiest way to implement?
2 - Should I used Box2D and Physics Body Editor to create a polygon shape and use it in the drop method to test the dragged shape with the static shape?
3 - How to test the vertices/edges using Vector2 to see if its is bigger or not?
Hope I am on the right direction.
All operations like moving,rotating,resizing drawn shape can be performed.I'm using as3 and flex4.6.
It seems like you have to use object handles library for moving,rotating, re sizing shapes ..
you can download this library from the below links.
https://github.com/marc-hughes/ObjectHandles
http://www.objecthandles.com/
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.
Can someone please help me to draw this shape in canvas?
Any help is appreciated!
You can try quadraticCurveTo ( https://developer.mozilla.org/en/Canvas_tutorial/Drawing_shapes )
Here's an example: http://jsfiddle.net/V9sVY/
To draw any custom shape use this site http://canvimation.github.com/ to directly draw the shape and to export it as a canvas. Viewing the source of the exported page will also show you the canvas script to obtain it.
For the above shape, change the grid settings to grid on and show to make sure you will draw a straight line. Choose the free form shape, click to start a line then double click at the end of the line. Drag the red control points to form the require shape. The control points do not lock to the grid but can help you gauge where to place them.
The following shows one possibility obtained by doing this.
ctx.beginPath();
ctx.moveTo(167,196);
ctx.bezierCurveTo(217,98,418,99,467,196);
ctx.bezierCurveTo(414,296,218,295,167,196);
ctx.closePath();
ctx.stroke();