Tag Info

Hot answers tagged

2

The intent of your code is unclear; adding comments would help us know what you're trying to do, and making sure that we don't have to scroll horizontally would really help. The first thing I notice, though, is that you check your system AND your update it at the same time, which could result in the behaviour you have: For balls A and B, if you inspect a ...


2

See the answer linked in the comments on your question for a detailed answer. Here is an undetailed answer: Say a character is moving to the right along the x axis. You move it at 1 pixel per frame. In 60 frames, it will be 60 pixels to the right of where it started. If you are running at 60 FPS, it will arrive at its destination in 1 second. If you are ...


2

GIS systems actually use polygons for this kind of information, where each "ring" is a list of coordinates, so you can take the same approach. Once your borders are defined in a list of points, you can triangulate them, assign vertex colors, or even apply UV values in order to apply a texture. Then the same mechanics apply as with a 3D model. Polygons are ...


1

I believe your error arises from rounding errors. I believe the problem could be solved by using float for pixel-coordinate storage. This way you will always get the exact increment needed for the given delta time, which is usually very small and thus the resulting per update increment is less than 1, and truncated to 0. Don't forget to use proper rounding ...


1

Your pixelOffset calculations are inconsistent... int pixelOffset = y + normX * 51; is different than... int j = x + normX; int i = y + normY; int pixelOffset = j + i * 51; One uses x * 51 + y and the other uses y * 51 + x. EDIT You are also reusing variable i and y. I think you want your blast circle to be based on your outer y value in addition to ...


1

Looks to me that your intersection code is not returning the correct position of impact. This could due that that when the game checks whether the bullet collide with the object, the bullet is already inside the barrier. You need to modify the intersection code to return the exact moment when the bullet hits the barrier.



Only top voted, non community-wiki answers of a minimum length are eligible