2d

Pathfinding in 2D Arrays

Let's say I have this 2D Array map { 0,0,0,0,7,1,1,1,1,1,1,1,1 }, { 0,7,7,7,7,1,1,1,24,1,1,1,1 }, { 0,7,24,24,24,24,24,24,24,1,1,3,1 }, { 0,7,23,23,23,23,23,23,24,1,1,3,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,24,23,23,23,23,23,23,1,1,1,1 }, { 0,7,23,23,23,23,23,23,24,1,3,1,1 }, { 0,7,24,24,24,24,24,24,24,1,3,1,1 }, { 0,0,0,0,1,...

What is the best language for a game?

Hi, I'm sorry if this is a dumb question, but what, in your opinion, is the best language to write a 2d puzzler in, and the best language for a 3d puzzler. Even the best language for both if you think there is one! Thanks. The platform would be Windows desktop application By best, I think easiest, fastest, most effective, and I suppose...

Algorithm to add new point to a polygon.

Greetings all, In the application I am developing I have polygons as show in the picture My data structure is double-linked list as follows. RzCurve { RzNode *head; }; RzNode{ double x; double y; RzNode *next; RzNode *prev; } I want to implement an algorithm which allows user to add a new Node by clic...

Panel not shown for 2D Animation

I was trying to create a 2D Animation in Java of a moving line on Panel(A line moving from one point to another in the Panel). I hope its possible. Here's the code I used. private void movingline(int length) throws InterruptedException { for(int i = 0; i + length < width; i++){ for(int j = 0; j + length < height; j++...

Calculating the Moment Of Inertia for a concave 2D polygon relative to its orgin.

Hi, I want to compute the moment of inertia of a (2D) concave polygon. I found this on the internet. But I'm not very sure how to interpret the formula... 1) Is this formula correct? 2) If so, is my convertion to C++ correct? float sum (0); for (int i = 0; i < N; i++) // N = number of vertices { int j = (i + 1) % N; sum += (...

Algorithm for finding nearest object on 2D grid

Say you have a 2D grid with each spot on the grid having x number of objects (with x >=0). I am having trouble thinking of a clean algorithm so that when a user specifies a coordinate, the algorithm finds the closest coordinate (including the one specified) with an object on it. For simplicity's sake, we'll assume that if 2 coordinates...

2D Rendering - From Back to Front with Different Heights

I'm wondering what the best way to render a scene made up of multiple-sized tiles, from back to front, with different heights. Like this: http://www.youtube.com/watch?v=Ahfrxm6ETgA Important stuff starts at 2:35. Ignore the horrible narration. :P I'm using VB2008. So here's what I have right now: My graphics consist of bitmaps that...

ORPG Engine Development, structuring the code (C++, 2D)

Hey, I've been working on a game 2d ORPG Engine with a friend of mine, however we're having some troubles organizing and structuring the code. I could use some pointers, guides, tutorials, etc. on how to keep the code flexible, extendible and maintainable. Thanks for your time, Xeross ...

XNA - Object Movement (?) gradually slowing down the game

Hello! I'm currently making a 2D game using XNA. I've made a class named GL_Object that contains my objects data (Sprite, Position, etc), and also contains a GL_Path object. GL_Path contains a GL_Motion. This GL_Motion object contains a list of GL_Movement objects. GL_Movement is a interface which holds two main methods, "ProcessMove",...

C++ - Vector-based Two dimensional array of objects

As suggested here I fixed my 2D array of numbers to make it work with Vector class. Header file: #include <vector> typedef std::vector<int> Array; typedef std::vector<Array> TwoDArray; And here is how it's used: TwoDArray Arr2D; // Add rows for (int i = 0; i < numRows; ++i) { Arr2D.push_back(Array()); } // Fill in test data ...

Algorithm to find whether 2 objects on a 2D Plane will collide

I'm trying to determine whether Object1 will collide with Object2 given the following information: 1) Objects' bounding boxes (uses bounded-box collision detection) 2) Objects' speeds 3) Object's current locations (x, y coordinate) 4) Objects' directions (Up, Down, Left, or Right) For a bit of imagery, imagine the objects traveling ...

Pseudocode for Swept AABB Collision

I think swept means determining if objects will collide at some point, not just whether they are currently colliding, but if I'm wrong tell me. I have objects with bounded boxes that are aligned on an axis. The boxes of objects can be different sizes, but they are always rectangular. I've tried and tried to figure out an algorithm to ...

2D-iPhone-Game with side-scrolling & platforms like Super Mario with Cocos2D?

I want to create a game where the player only can run and jump on platforms. I think Cocos2D would be great for that but i haven't found any tutorials for cocos2d and side-scrolling. Where I have to start? ...

WPF: Resizing a circle, keeping the center point instead of TopLeft?

Hi all, I'd like to resize a circle on my canvas with the help of a slider. This circle can be moved around on the canvas by some drag&drop stuff I did in code behind, so its position is not fixed. I have bound the slider's value to an ellipse's height and width. Unfortunately, when I use the slider, the circle gets resized with its to...

How to show the parallelism of requests in a nice graphical view?

I have currently the following setup: An object graph of all requests read from an application server log file. Each line is represented as a RequestPart, with the following information: start time, stop time, tier, application part that is done. I would like to draw / to graph something that shows the following: Show different col...

Topology, scaling

Say there is a 2D plane (square) with some points inside it. How to move all the points in such a way that they fill the plane as evenly as possible but every point maintains its neighbors? In other words, I want the points to be as far from each other as possible but their locality (topology) should be preserved and they should lay in...

Shooting bullets with cocos2d and sneakyjostick (math)

My Code: -(void)ShootingWithJoystick { if (_nextProjectile != nil) return; CGPoint location = CGPointMake(rightJoystick.velocity.x,rightJoystick.velocity.y); // Set up initial location of projectile _nextProjectile = [[CCSprite spriteWithFile:@"player.png"] retain]; _nextProjectile.scale = 0.2f; ...

rotation of 2d shape clockwise direction

I am new to python and graphics but have programmed before. According to http://en.wikipedia.org/wiki/Transformation_matrix#Rotation , For rotation by an angle θ anticlockwise about the origin, the functional form is x' = xcosθ − ysinθ and y' = xsinθ + ycosθ But the following python code rotates it in the clockwise direction....

XAML animation to bound property

I have the following Rectangle bound to an ever-changing positioning property "RectTop" <Rectangle Canvas.Top="{Binding RectTop}" Height="100" Width="100" Fill="Red" /> Is there I way I can set up an animation/trigger to smoothly animate the rectangle to RectTop whenever that value changes? RectTop changes constantly. RectTop's class ...

Does anyone know of any sprite collections?

I am making a 2D Java game. I want the game to look nice, so I need good sprites, but I want to focus on the coding of the game, not the graphics design. This project has a time constraint so having premade sprites would be very helpful. Does anyone know of any good sprite collections? ...