New answers tagged 2d
0
votes
How to build a system for ammunition being fired out of cannons when player characters and crewmates can also be ammunition?
Whenever you want to be able to do similar things with different objects, you should create a reusable component.
As an analogy, think about how you typically add physics to a GameObject. Whether that ...
0
votes
Accepted
Player is able to interact with objects but enemy isn't able to
Turns out I made a beginner mistake. I mistakenly used OnCollisionEnter2D instead of OnTriggerEnter2D.
1
vote
Accepted
How to animate a 2D top-down fish?
A solution was using the skeletal animation approach and adding inverse kinematics (let's call this IK) to the tail.
I made it so the tail IK wouldn't rotate with the body which meant that the tail IK ...
0
votes
Collision callbacks not working
I fixed the issue. I needed to give my player object a new tag called "Player"
1
vote
Collision callbacks not working
Your scripts are okay, your issue is due to scene setup rather than coding.
In order to detect a trigger collision, OnTriggerEnter2D() has some requirements:
Both objects must have one ...
0
votes
Performance for range of effect in city builder
Currently I am using spatial hashing to detect if the insertion of a
building intersects a building in the board.
[...]
[I have the] effects working as it should, but its slow because I am
checking ...
0
votes
Line of sight on a 2d grid
Here is an old VB function that implements a solid square grid LOS that works great.
I hope this helps someone out.
...
2
votes
Performance for range of effect in city builder
Sounds like a use-case for influence maps.
For every kind of building effect you have, you create a two-dimensional array of integers with the size of your map. These are "influence maps" ...
1
vote
Draw a graph as a world map in UI?
I ended up storing some information at map generation time that guides map layout in UI.
I generate the map nodes into a grid (to help bound the total size of the map) and lay them out as follows:
...
0
votes
SDL2 and TmxLite (Tiled) (Reading the actual TILE data from the layer)
Well I doubt this is the proper way to use this. But I was able to get the array of Tiles (which was essentially just an array of int 'ID') as follows:
...
2
votes
Trying to move the snake smoothly in a 2D game
The "traditional" snake game is grid-based. Basically, maintain a list of body positions. Add a position node from the head when moving, delete a node from the tail, and not delete when the ...
Top 50 recent answers are included
Related Tags
2d × 3341unity × 1030
c# × 436
collision-detection × 346
physics × 332
java × 297
xna × 259
sprites × 247
c++ × 159
animation × 159
movement × 148
mathematics × 142
opengl × 137
tilemap × 128
3d × 125
platformer × 125
tiles × 121
android × 120
camera × 114
javascript × 111
graphics × 105
libgdx × 98
algorithm × 87
rotation × 87
lighting × 80