Hot answers tagged

3

If you need to wrap just a few steps out of bounds (up to negative size), then you can do this like so: (size + coordinate) % size When coordinate = -1 then this gives you (size - 1) % size = size - 1. And when coordinate = size then this gives you (size + size) % size = 0. For any value in between (0 to size - 1), this behaves the same as the identity ...


2

The pixel-perfect camera component automatically scales your view so each texel in your sprites maps to an integer number of pixels on the screen. That means it's limited to scaling by whole-number ratios: 1x, 2x, 3x etc. Within those constraints, it tries its best to fill the current size of the window/screen with the largest texels it can, while still ...


2

If we venture down to the Godot source code, on Polygon_2d.cpp we find how polygons is used (here). Godot expects the array to contain arrays of integers. Reading the code we can also figure out that they are indexes (0 based) for the points. So, let us try that. We create a Polygon2D on the editor, give it a set of points, and then in the polygons property ...


1

This is expected as time is passed "by value" (you copy the content of the variable "into the function"). Perhaps you need to change your approach to "timer" as there appears to be no equivalent to "get_timer" to get the time left before the event is fired. I'm not exactly sure how your whole game is developed, but you ...


1

Sorry I am not bringing "graphical" solution. But as you said every suggestion is welcome. So this should work also: A script which is run on each torch, not each tile. Your torch reach is 5 tiles. So that is 5 tile radius. That means that one torch has to update 88 tiles. 88 calculations is not that expensive. If torch is moving: You can achieve ...


1

Ok, first, you are going to need to put your nodes inside a YSort node. And make sure it is enabled. The YSort node will sort the sprites by their vertical position (y-axis). Second set the offset attribute of each Sprite. This attributes allows you to move the texture. What you want is to set it such that the origin point of the Sprite is along what should ...


1

This problem is usually worked out by collisions. Hopefully your tile editor allows you to set groups of tiles together along with their collisions, so you don't forget to set them. And that's it. However, there might be parts of a game where you need to support something like this, and there is a way to do it that is not making everything entities… As you ...


1

I'll be referring as agent to the opponent controlled by the game. And agent controller to the code that, well, controls the agent. You can have an abstraction for your agent controller, and still allow continuous movement. To do that, you would have code to translate between those representations. That is, the agent controller would understand the game in ...


Only top voted, non community-wiki answers of a minimum length are eligible