New answers tagged

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 ...
user avatar
  • 3,505
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.
user avatar
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 ...
user avatar
0 votes

Collision callbacks not working

I fixed the issue. I needed to give my player object a new tag called "Player"
user avatar
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 ...
user avatar
  • 4,037
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 ...
user avatar
  • 173
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. ...
user avatar
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" ...
user avatar
  • 112k
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: ...
user avatar
  • 417
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: ...
user avatar
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 ...
user avatar
  • 1,091

Top 50 recent answers are included