New answers tagged 2d
2
votes
Emulating 3d trajectory in top-down 2d game?
I created this version which uses a target position and t (time 0-1).
I would loop this function in an update function if (t < 1) t would increase by ...
1
vote
Changing the scale of a character and speed to match the perspective of a 2D background while traveling along the Y axis
You have the correct idea.
It might be easier to manage if you define the scale at two different points and interpolate/extrapolate it.
For example, if you know that \$Y_1\$ the scale should be \$S_1\$...
0
votes
How to Prevent Enemy Overlap
If you are ok with more work on sprites you could simply use different sprites for the enemies.
You could have enemies composted of randomized different parts. This is probably overkill just for this ...
0
votes
Accepted
How can I solve this error and this warning when destroying instantiated prefabs?
I solved this problem more than a month ago but forgot to post an answer. So, here's the answer:
Basically, instead of constantly instantiating enemies, I put a number of them above both triggers and ...
2
votes
Is there a logical reason for SFML's Vector2 being templated?
Why would you ever want to use any other type than float for positional math?
The other answer covers this pretty well but some aspects of your post has not been tackled.
Is there a logical reason ...
1
vote
Can I rotate the velocity of a rigid body?
I got it working using DMGregory's suggestion.
This line is the ticket, just adjust the "20".
...
2
votes
KinematicBody2D stutters/moves back and forth
Are you not overshooting your target?
You have this code:
...
0
votes
Accepted
How to rotate NavMeshAgent toward its movement direction?
You can avoid the trig and angles by using the LookRotation helper method in a slightly different way:
...
0
votes
How to rotate NavMeshAgent toward its movement direction?
I've solved it with help of ChatGpt. Here's the code
...
0
votes
How to make 2D lighting in JavaScript
Sorry for reviving the question, I know its already answered, but I came up with my own solution that does require an offscreen canvas, but it is pretty fast.
(WASD to move camera, scroll wheel for ...
3
votes
Accepted
Is there a logical reason for SFML's Vector2 being templated?
Unity, for example, has both Vector2 and Vector2Int types (and so on for other dimensionalities), since C# didn't/doesn't have ...
Top 50 recent answers are included
Related Tags
2d × 3465unity × 1092
c# × 463
collision-detection × 367
physics × 345
java × 297
xna × 260
sprites × 260
animation × 165
c++ × 164
movement × 158
mathematics × 147
opengl × 139
tilemap × 132
3d × 131
platformer × 129
tiles × 124
android × 120
camera × 115
javascript × 113
graphics × 105
libgdx × 98
rotation × 96
algorithm × 91
lighting × 83