Slingshot in box2d and libgdx - java

How can I achieve something like this?
https://www.youtube.com/watch?v=qnpkd3Ucg7s
I know it should be done with a MouseJoint. The only problem is that I don't know how to "pin" the MouseJoint to the starting point. Everthing else I will manage to solve.

Is very easy to create a mouse joint, check up this youtube tutorial:
http://www.youtube.com/watch?v=dF5dUiJtYng
And check up the source for the video you provided
http://appcodingeasy.com/Gideros-Mobile/Gideros--Box2d-Slingshot

Related

Images on a Image

I am new on this community and i have no idea what I have to search for. So I hope there is no thread like this.
I want to create a java Android App in Android Studio where I can open a floor plan(image) and insert icons(images). If i click once on the icon it should be movable and the size of the icons should be adjustable with a seekbar.
I googled for these functions and the only thing I found was that:
https://developer.android.com/guide/topics/graphics/2d-graphics.html
Can someone tell me which is the best way to do that?
You can use normal ImageViews https://developer.android.com/reference/android/widget/ImageView.html
with events (OnClick, OnTouch).
If you want to resize view, check this answer
-https://stackoverflow.com/a/14283837/8180966
For rotation
//#param rotation The degrees of rotation.
imageView.setRotation(float rotation);
If you want your icons to look nice at any size, you should look at Vector Graphics (https://developer.android.com/studio/write/vector-asset-studio.html)
Hope, this will help :)
You may please visit the following page (especially layer list section of the page) of android developer site. There are a few things which you may be interested in and which may serve either as a solution or an alternative to your problem.
https://developer.android.com/guide/topics/resources/drawable-resource.html

Display animation in java?

I am very very new at java (as in, I took one beginner course) so please don't get super technical when answering me.
Earlier today I learned how you can load an image in java and display it in an applet.
I found a step-by-step youtube video that helped me do this.
Now I want to know how I can load an animation in java. Is that something that can be done? And can I get step-by-step instructions on how to do it? Basically, I already have a short .wmv file and I would like to display it when I run the program.
It also has audio that I would like to play along with it.
(i'm actually trying to make a video game with an animated character. java can be used to program games, so this should be doable, right? i don't care about making a game the "right" way or the way game developers usually do it, right now i just want to figure out the simple task of displaying an animation in java.)
thanks!
First of all, the wmv extension stands for video, and an animation is not a video. Its either a spritesheet, a gif image ect. In order to create a even simple animation, you must first learn some basic object oriented programming, become comfortable in creating and using classes, than you can advance to making your own class for taking care of sprites and cutting an image in a way that you can use it ect.
Example of a simple spriteshet:
This spritesheet is an simple image showing you one way to implement your 2d animation. You just have to cut the image parts from it using some rectangles. For 3d, you must use some other software and you must know that they use different kinds of extensions.
I wont dive into code, for the simple reason that I do not have time right now, but if you want further help, give my some contact like skype, facebook ect, I would love to help.
You could try the Java Media Framework javax.media.*. (caveat: rather old framework)
It appears you simply need to embed a media file such as video or audio into an applet. This can be achieved through a player embedded into an applet, similar to an individual frame or a .GIF file, that would be able to handle the .WMV extension.
Assuming awareness of the basic structure of a Java program, the main declaration to get an instance of a player is of the generic form, after:
player = Manager.createRealizedPlayer( mediaURL );
or
player = Manager.createPlayer( file.toURL() );
Good idea to go through the JMF documentation.

Flat infinate line?

I know that this is probably a very, very basic question but I'm very new. Basically I want to create a platform that my character can walk on. Almost like in the game "Flappy Bird" but, I want it to be a walkable platform. Is there any way I can create a "line" that stretches out infinitely. I've seen this, but it's for iOS and isn't a flat line. I've tried researching, but I haven't seen anything that appeals to what I'm looking to achieve. Any help would be great. As a heads up I'm using libGDX Also leading me to any tutorials for something similar would be equally appreciated.
There is a tutorial to create an exact copy of flappy bird
http://www.kilobolt.com/zombie-bird-tutorial-flappy-bird-remake.html
Could you modify this to create your walkable game?

ArcBall Camera Android

I'm trying to create an arcball camera for use in my 3D Android game (note: I am using the libGDX framework)... I am having trouble figuring out how to go about creating it. I can probably extend the current PerspectiveCamera class in libGDX and add some logic to handle the arcball rotations around a sphere, but I need an explanation about how it works. I am still learning OpenGL ES but I think I'm at a good point to attempt this.
I found your question and this (stackoverflow) answer while looking for the same thing myself.
I haven't tried the code out myself yet, so I can't confirm whether it works or not.
I'm going to need something similar myself for my game idea, just wanted to make sure I've got everything I need ;-) .
Let us know if this does the job.
Cheers

How to draw a cross on Google Maps?

I have following task - I need to draw on Google Maps a cross with certain coordinates. I know how can I do it using ItemOverlay but I think that there is means without using a custom marker. I need simple black cross with my coordinates. Please, tell me, is it possible?
UPDATE: I don't want to use ItemOverlay because I need to make a custom drawable for it and I hope there is simple android internal elements for it.
I'm sorry, but using Overlays seems to be the only way of drawing any line on Google Maps.
You could draw an ImageView right over the google maps view (with absolute positioning using margins). But then you'd have to take care of coord conversion (and reacting to user scrolling, zooming the map) "by hand".
I think you could also use SurfaceView fully aligned to google maps view and draw your marker right on it.
But both solutions are pretty much overkill; you're better off using ItemizedOverlay unless you have a really good reason no to - in which case you might wanna add some info on what's the reason, maybe we'll find you a nice solution to that one :)

Categories