Tagged Questions
2D games are drawn in a two-dimensional space using two-dimensional objects. To represent its position, each game object will have an `x` and a `y` coordinate.
0
votes
0answers
10 views
How to approach rendering in a 2D Sprite-based game?
Let's assume you have some classes like Player, Enemy, Map and Tile.
The first approach would be to let the things draw themself, e.g.:
void render(){
player.draw();
enemy.draw();
// etc.
}
...
1
vote
1answer
89 views
How do I make a 2D character aim their gun toward the mouse?
Heli Attack is a perfect example of the shooting mechanic I'd like. The character aims perpetually toward the mouse. What's going on here?
From what I've read so far, you could separate the arm and ...
-2
votes
2answers
66 views
What kind of calculations do I have to make for projectiles?
I could never find out, how to create projectiles in a 2D game. Does it need linear algebra? If not, what to do to calculate its path?
I just simply want to create a projectile that follows a ...
0
votes
0answers
27 views
Designing 2D Characters [on hold]
I'm just starting with Unity to create games for Android. I have a lot of programming experience, but I suck at drawing. I don't have the funds to hire a designer, and I'd rather learn the processes ...
0
votes
1answer
23 views
Grid collision - finding the location of an entity in each box
I am trying to implement grid-based collision in a 2d game with moving circles. The canvas is 400x400 pixels. Below you can see the code for my Grid class. What I want it to do is check inside which ...
-2
votes
2answers
51 views
How to calculate a bounding rectangle of a polygon?
Polygon poly = new Polygon();
poly.getPoints().setAll(5d, 15d, 15d, 25d, 5d, 30d);
How do I calculate the Polygon's height and width? There is no poly.getWidth() or poly.getHeight() method in ...
-1
votes
0answers
18 views
How to create an invisible rectangle around a circle? [on hold]
The reason why I'm asking is so it's easier to create Grid based collision detection.
So how do I create an invisible bounding box around a circle/polygon?
0
votes
0answers
10 views
Specific method gets called at weird time intervals [on hold]
I'm making a 2D game in Java. I have a specific method that moves an AI spaceship around the screen towards a specific radius from the player's spaceship. (Let's call this method FollowPlayer()).
...
2
votes
2answers
73 views
Calculate shadow map to overlay hidden line-of-sight things in 2d?
Given a 2D sideview with even-sized grid squares and our hero in a known center-ish position like this
... and imagining this hero's line of sight like this...
how could one get the point values ...
2
votes
1answer
92 views
Strange collision behaviour in 2D game even though the collision is very basic
I have a player ship (cube) and some enemy laser projectiles. When the player ship has position X values greater than 1, collision with the enemy projectiles occur but when it has lower X values, the ...
0
votes
0answers
41 views
Make circle rotate around a point [duplicate]
Circle c1 = new Circle(20); //Initialize
c1.relocate(200, 200); //Set coordinates
I will say right off the bat that I do not understand trigonometry. From what I've been able to find online, I need ...
0
votes
0answers
38 views
Efficient tilemap rendering with layers? [on hold]
The tool I'm using to develop my game is extremely inefficient, and I cant use another tool for now.
If i render the map tile by tile, 32*22 tiles, it gives me a performance of 1fps. So its not ...
7
votes
3answers
330 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
1answer
42 views
What do the 6 points stand for in Polygon().getPoints().setAll?
I have the following code to create a polygon:
Polygon poly = new Polygon();
poly.getPoints().setAll(14d, 17d, 26d, 17d, 20d, 27d); // What do these mean?
What do these 6 points stand for?
3
votes
2answers
168 views
How can I “grow” regions representing countries in a 2D grid?
My friend started to make a 'country-generator' type of thing. We have some starting points, and we want to 'grow' countries from them randomly until the whole area is filled. What's is an effect ...