0
votes
1answer
83 views

Moving turret aiming at moving target

I've found this post Turret Aiming Formula on Reddit and a nice answer a while back. The solution in the answer works great for still sanding turrets but is almost unusable for moving turrets since ...
3
votes
1answer
55 views

Field of view determination with partially opaque cells

I'm currently implementing the field of view of a player in a 2D-grid based game. I've chosen a standard ray tracing algorithm because he really fits the features needed in my game. However, the ...
0
votes
0answers
46 views

how to do picking in 2d lwjgl

I searched the whole internet, but I couldn't find something useful. How to do picking (like ray picking) in lwjgl in orthographic mode (2d)? I think this is less confusing than picking in 3d, but I ...
4
votes
1answer
356 views

Algorithm for randomly generating reachable platforms

I want to randomly generate reachable platforms on the fly for a 2D game. Right now, I am just creating platforms at random x,y positions. Only 4 platforms can exist at once, so once the 5th one is ...
0
votes
1answer
34 views

Best method for selecting points from a point set - path distance

having a big set of points and a polygonal path what is the best way to select a set of points that are at a certain distance or smaller from the path? Or do I need to iterate thru all points on each ...
6
votes
1answer
177 views

Square Grid Polygonal Terrain Query algorithm?

I have a square, fixed-grid terrain with one terrain type per grid unit in my game, and I want to do an arbitrary polygonal terrain query which returns all of the grid units enclosed/intersected by ...
0
votes
1answer
93 views

What are the correct angles in the Top-down perspective?

In the following picture it says that in the Top-down perspective the angles are 90°, but if it would be 90° then you shouldn't see the front of the building and the roof at the same time... So what ...
8
votes
3answers
447 views

Can I jump from A to B?

I'm making some rudimentary AI for my side-scroller and I need to know whether an AI unit can reach point B from point A simply by taking a jump. Flight trajectory of my characters is a bit unusal as ...
-2
votes
2answers
106 views

Convert atan2 value to standard 360-degree-system value [duplicate]

Lets say I'm using atan2 to get the angle between two vectors. atan2 gives a value in radians. I convert it to degrees using a built in function in Java. This gives me a value between 0 and 180 ...
4
votes
2answers
389 views

How do I use the dot product to get an angle between two vectors?

I am learning to use normalized vectors in my games. I've learned that in order to know the angle between two vectors, I can use the dot product. This gives me a value between -1 and 1, where 1 ...
1
vote
3answers
321 views

Calculating 2D Physics Prediction of Shot Angle with Moving Velocity of both targets

I currently have the math right to hit a moving target with 99% accuracy as long as I don't move. When I start moving the aim is nearly 80%, it should also be 99% accuracy because the target is moving ...
0
votes
2answers
99 views

very simple math destination and speed calculation

My player goes to (destinationX, destinationY) His position is: (x,y) and the player has an update event function update() { this.x = this.x + dx; this.y = this.y + dy; } what is the formula ...
1
vote
1answer
157 views

How can I implement jumping in a 2D game using bounding box collision?

Problem: I'm trying to implement basic jumping to my 2D game engine, but have failed several times. Basically what I've done so far is disabling gravity and using a separate function moving the player ...
2
votes
1answer
202 views

Circle to Circle collision - bad accuracy

Circle1 (blue) is moving and its X and Y bounds are the screen (meaning it bounces off the walls). Circle2 (black) is stationary. Circle1(blue) is supposed to bounce off of Circle2 without ...
-1
votes
1answer
224 views

Java moving image to where it is facing

I am trying to make an Asteroids type game. I searched and tried everything to move an image along its angle (as radiant). Using my knowledge of trigonometry I made the following calculation: x += ...
7
votes
1answer
220 views

How do I get the areas enclosed by an arbitrary 2D shape?

In my game I want users to be able to draw arbitrary 2D shapes of any length around game objects. The shapes must be closed and drawn with a single stroke that does not overlap. For example: I ...
1
vote
2answers
611 views

2D Island generator algorithm - chances of tile becoming land

I am developing my first island generator (in c#). I am using this algorithm as my basic idea : http://www.funstormgames.com/blog/2012/09/procedural-island-generation-for-ludum-dare-24/ Basically ...
3
votes
0answers
172 views

Display and Hide CCSprite with Genie effect

I am new at cocos2D. I started to learn cocos2D with simple game from http://www.raywenderlich.com/tutorials#cocos2d tutorial. Now I'm crazy with animation, so now i want to display CCSprite as OSX ...
0
votes
1answer
132 views

Rotate 2d sprite towards pointer

I'm using Crafty.js and am trying to point a sprite towards the mouse pointer. I have a function for getting the degree between two points and I'm pretty sure it works mathematically (I have it under ...
1
vote
3answers
95 views

Move from point a, to point b, and determine the accuracy

Let's say I have a circle at point a (0,0), and I wish to move it to point b (23,58), whatever, how can I accurately do this with a speed variation if I wanted. (I'm doing this in javascript). Every ...
5
votes
1answer
656 views

2D car physics and high speed turning

I've been looking at the following page, which has been very helpful: http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html but have come into problems with the ...
4
votes
1answer
773 views

3D isometric depth sorting

How is it possible to depth sort tiles and objects in an isometric environments without any limitations? I've been researching this for a while now and there seems to be no publicly available answers ...
0
votes
1answer
511 views

Please help me with my 2D isometric tile picking [duplicate]

Possible Duplicate: How to convert mouse coordinates to isometric indexes? Okay, I apologise in advance if I make no sense here. Basically, I've got a simple application that takes in a ...
3
votes
1answer
273 views

How to do perspective projection “parallax” but without changing the scale or offset of objects?

Hello everyone I have this problem that I have tried everything I could think of. The problem: I am making a 2D game with parallax effect but I am using 3d space so am not simulating the parallax but ...
0
votes
1answer
113 views

Find the footprint of an isometric entity

I'm working on making a 2D isometric engine in Java. I'm getting into collision detection and I've hit a bit of a problem. Characters in-game are not restricted to movement from tile to tile - they ...
3
votes
1answer
69 views

Retrieve outer most points on a 2d graph

G'day everyone, I have a 2d graph which has some points plotted on it. What I need to do is get only the outer most points so that I can connect them up (isn't really relevant). What I can't seem ...
-1
votes
3answers
2k views

Scale a normalized 2D vector always to the same length

For any normalized 2D vector, except for ( 0, 0 ), how would I scale the vector to always be the same length? For example: int length = 10; vector v = vector( 0.1, 0.5 ); vector v2 = vector( 0.3, ...
1
vote
2answers
1k views

Line Intersection from parametric equation

I'm sure this question has been asked before. However, I'm trying to connect the dots by translating an equation on paper into an actual function. I thought It would be interesting to ask here instead ...
6
votes
1answer
881 views

Re-create 2D side-on wave effect from Worms game

I'm trying to recreate the waves/water effect from Worms ( see here http://youtu.be/S6lrRqst9Z4?t=31s ) From what I understand its not actually a sprite, its procedurally generated by something like a ...
1
vote
1answer
294 views

Point inside Oriented Bounding Box?

I have an OBB2D class based on SAT. This is my point in OBB method: public boolean pointInside(float x, float y) { float newy = (float) (Math.sin(angle) * (y - center.y) + Math.cos(angle) * ...
5
votes
2answers
940 views

How can I generate a navigation mesh for a tile grid?

I haven't actually started programming for this one yet, but I wanted to see how I would go about doing this anyway. Say I have a grid of tiles, all of the same size, some traversable and some not. ...
5
votes
3answers
2k views

Is it possible to map mouse coordinates to isometric tiles with this coordinate system?

I'm trying to implement mouse interaction in a 2D isometric game, but I'm not sure if it's possible given the coordinate system used for tile maps in the game. I've read some helpful things like ...
1
vote
1answer
167 views

Can't work out how matrix is applied to 2D vertices

I have a texture, some 2D vertices, and a matrix. The matrix is used to calculate the texture coordinates for each vertex, but the problem is that the matrix comes with absolutely no documentation and ...
2
votes
1answer
240 views

Constrained/penalized distance function

Assume a character is located on a n by n grid and has to reach a certain entry on that grid. Its current position is (x1,y1). Also on the same grid is an enemy with coordinates (x2,y2). Each step ...
2
votes
2answers
2k views

How to move a line of sprites in a sine wave?

So, I'm spawning a horizontal line of enemies that I would like to have move in a nice wave. Currently I tried: Enemy.position.X += Enemy.velocity.X; Enemy.position.Y += ...
4
votes
2answers
4k views

Basics of drawing in 2d with OpenGL 3 shaders

I am new to OpenGL 3 and graphics programming, and want to create some basic 2d graphics. I have the following scenario of how I might go about drawing a basic (but general) 2d rectangle. I'm not ...
3
votes
2answers
513 views

Trying to understand 2D vector -> projection space conversion

I'm trying to understand how I can transform 2D vectors (x, y) to projection space. Something hasn't quite clicked for me yet. As per my previous question, here's the effect I'm trying to achieve: ...
4
votes
2answers
3k views

How to calculate shot angle and velocity to hit a moving target?

I am developing a 2D Android game and I am making an aiming algorithm for AI projectiles to hit enemies either following a path, or free moving. At the moment it just calculates where the target will ...
6
votes
2answers
1k views

Matrix for 2D perspective

I'm trying to determine whether what I'm attempting to achieve is even possible mathematically. I'm obviously not a seasoned game developer so I'm having trouble even coming up with the terminology to ...
4
votes
2answers
329 views

How to draw equal length line stripes on a parabola?

Simply put I'm making a basketball game. I'm using these equations to predict the ball position and it works fine: x = vx * t y = vy * t + 0.5 * gravity * t * t But I can't find a way to draw equal ...
1
vote
1answer
606 views

Relating a point after an image is panned and zoomed

For Android, let's say you have a image of a map that you draw inside your view. On this map there are many, many "hot spot" locations where you want your user to be able to select. Given that there ...
4
votes
2answers
853 views

What is a good way to determine if a vector is between two other vectors?

I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, ...
8
votes
1answer
887 views

2D helicopter game, how to create corridor walls?

I'm looking into adapting the classic "helicopter" game (i.e. http://www.addictinggames.com/helicopter.html), but I haven't yet figured out how to create the walls-generation engine. Any pointers ...
8
votes
2answers
669 views

Function for sun movement?

So, given a sun sprite set at the horizon (x = 0, y = worldheight/2) I'm trying to devise a function to make the sun rise, then fall. The best way to do this would be the sin function, but I have no ...
14
votes
5answers
3k views

Quick 2D sight area calculation algorithm?

I have a matrix of tiles, on some of that tiles there are objects. I want to calculate which tiles are visible to player, and which are not, and I need to do it quite efficiently (so it would compute ...
2
votes
3answers
513 views

Find new position of rotated by 10 degrees line

I have a line that goes to x (x1) of 300, and then I rotate the line by -10 degrees. How can I get the new x (x0) of the rotated line? Here's a picture to show what I mean: Are there any books ...
7
votes
3answers
975 views

Find a unit vector exactly halfway between two connected line segments

Seems like a quick and easy question but I haven't been able to find exactly what I'm looking for so: How to calculate a unit length vector that is pointing along the line which is exactly 50% of the ...
7
votes
2answers
2k views

How to calculate the vector of an interception?

Given are a twodimensional space, and 1 friendly spaceship standing still, one foe is moving NOT directly to the friendly ship with known actual position, speed and direction. The friendly ship wants ...
10
votes
1answer
2k views

Angle of Reflection

I have this "Breakeout style" game. I have a cannon at the center, blocks around the cannon and pads around the blocks. This is how the game looks like: I've managed to get the collision per ...
9
votes
3answers
7k views

Sorting array of points in clockwise order

Is there such an algorithm to sort an array of 2D points in clockwise order? I'm specifically dealing with right triangle in my case so only 3 points. However I'm interested in knowing if such an ...