Android 2D-pixel perfect collision library - java

I'm working on a 2D four-side scrolling game and I am currently implementing collisions. I was surprised to see that there is no pixel-perfect collision library implemented in the standard library, and so I wrote my own collision "engine" with geometrical forms to represent non-geometrical figures. For now, it works fine, but I really want to know if there's a way to just get it all over with, thanks to a well-built library. If anyone knows of one, please share it.

I recommend you to take a look to AndEngine. You can see one video here about 2d pixel perfect collision:
http://www.youtube.com/watch?v=abbXURuDaTo

Related

Agar.io-like cell physics

I wanted to make a circle that has a ripple-effect on the edges, kind of like in the game agar.io. I am kind of lost on how to implement it. Obviously I can't just g.fillOval() because that would draw a solid circle with no movement on the edges.
I'm not asking anyone to write any code for me (but if you really want to, I don't mind :D), but if you could point me in the right direction with some methods I should use. I am using Slick-2D library for java, if that helps.
I also tried analyzing the javascript source from the agar.io website to try to understand how they implemented it in javascript, but I was unsuccessful because the code was obfuscated; all the methods and variables were just single letters.
The only way I can imagine doing this currently is to have each circle be composed of a number of points, and let each point have it's own physics, and it can be affected by other points. If anyone who has insight into this problem, I would greatly appreciate some help. Thank you!
I'm not sure you can do this with Slick2D. It is quite high level and gives a lot built-in classes. What you want to do is really specific. As Slick development has stopped you will not get new features. You should probably look at lwjgl which is the base of Slick. It is more low-level but can be more precise with the form you need.
You can look at this project to have some drawing cool stuff. And for another example of manipulating circle you have this one

Basic dynamic 3D collision in LWJGL

sorry about my last question it was a bit all over the place.
I have hit a huge road block with a game I am coding for a friend and i need to learn dynamic collision. A tutorial would be great, a very basic one and i have already seen the NeHe collision detection tutorial and did not seem to pull much from it.
Thanks in advance to all who reply.
What you could do is create a invisible 3d box surrounding your entities and check when two or more of said boxes have intersecting xyz coordinates. I can't supply you with code, but I know it works. You would have to figure out the coding for yourself

3d Way Finding Mapping

Hello there guys and gals
I'm just little bit confused about creating simple way finding using the java programming language?
Or is it possible in java? I want to create a simple way finding just like these
Do you have any suggestions for this particular matter?
You need to use a shortest-path algorithm and a matrix-builder from the way-points of your map. Java 3D has built-in primitive shapes such as cylinders, spheres and cubes. But you can make your own geometry from points, triangles and quads. See some of the java3D tagged questions in SO.
In java3D, mouse and keyboard interaction is very easy implemented.
Collision detection is also a good pro of java3D while not having a shadow lib being a con.
You can try 3D Wayfinder. They have a public API and fully featured 3d wayfinding. Its not in Java but uses HTML5, WebGL and JavaScript. Yiu have to upload just a floor plan model and are good to go.

Android game development structure

I would like to develop a game on Android platform, I have about a year experience with Java and also used the OpenGL library in C++. I also programmed Minesweeper and Connect Four in Java. Basically, here's the type of game I want to create:
Pressing the screen would make your character go up in the screen and releasing it will make it go down. I know there are games like this already but it doesn't matter to me, it's my current goal.
The structure of both games I programmed was quite easy, it was only a GridLayout. This wouldn't fit in any defined layout. Then, I have absolutely no idea how to test a character/environment collision. I'm also wondering what would be the easiest/fastest way to draw the "collision" environment, I assume it would be with OpenGL but from what I know, it would still take a long time and wouldn't be that easy.
I've been trying to find a tutorial about this but obviously, I've been unsuccessful.
PS: I already know the basics to make an Android app so you shouldn't need to worry about that.
think about each segment of what you're trying to achieve individually.
First off, you could probably read up on libgdx: http://code.google.com/p/libgdx/
it's a great android game engine which will do alot for the work for you.
For the player, think of it as just incrementing the players y position by a few pixels if it's pressed down, else decrement it.
For the map, you'd probably need some sort of 2d polygon based collision for the upper and lower collideable environments, libgdx has a physics library built in but i'm not sure how the support it for polygon-based collision. And finally, just create the map and make it wider than your game screen, and just move the camera along as the player moves.

Appropriate Transformation for 3D-looking 2D drawing (Java)

I'm looking for the appropriate transformation to make a 2D image look like a 3D drawing. If I draw a "road" with parallel lines on a sheet of paper, and then tilt the top of the page away from you, so that the road appears to be disappearing into the distance is what I am looking for.
I'm using Java and would like an appropriate API/library. I don't believe "AffineTransformation" accomplishes this.
You don't want an AffineTransformation, as that will always preserve parallel lines, which isn't what you want here.
Luckily the Java Advanced Imaging API (javax.media.jai) has exactly what you want, in the shape of the PerspectiveTransform class (click that link for docs).
Your problem is not trivial, but certainly solvable. You can take any four-sided image and apply a 3D perspective transformation. Just don't expect it to be a one-liner.
I'm at home now (checking SO before going to sleep, of course :D), but I'm almost 100% certain this is the site I used to find the appropriate code in C#:
http://ryoushin.com/cmerighi/en-us/61,2007-10-29/Image_Distortion_Enhancements.aspx
Porting it to java should be fairly straightforward. Let me know if the link doesn't solve your answer and I'll edit my answer tomorrow with more info.
I can't give you a simple answer, but I can tell you that what you're looking to draw is called two-point perspective. With this information, maybe you will be able to find a library that takes a 3D object and produces a perspective view.
Here's a simple Java applet that I've seen previously that demonstrates 2-point perspective:
Link
Hope this helps!

Categories

Resources