I’m using the top-down movement to move an isometric sprite along a tiled path but I need to know if it has moved say 32px on the X or y using time delta so I can make accurate turn’s.
I’m already using a collision event with the tile to determine which directions are available.
I don’t understand why it must be with timedelta, isn’t it something that can be solved with a timer?Are the turns limited both by time and by space moved?
Sorry, I just mentioned time delta as I thought it would be a constant way of doing it, the way I’m doing it is to have a tiny collision mask in the centre of the floor tile, which triggers which directions are available and to change direction if needed but it is very inconsistent in that it keeps creeping off center and once off center it starts missing the collision mask.
You can store in two variables (object or scene variable) the X position and the Y position of the character before each movement and then an event that includes as a condition that it can move as long as the position X of the character is less than or equal to “the previously stored variable + 32”. If there are more directions and senses of movement possible at the same time, you should play with this, but always storing the position in the X axis and in the Y axis in two different variables before each movement to have this value and compare it to another that be the limit. On the other hand, I would not use collisions to detect possible directions of movement because collision detections consume more resources and are not the best, instead I would use raycast. Here is this example that may be useful to you. I don’t know if it’s something like this that you want to do in your game, but you can take a look and adapt it to the needs of your game.
Thanks, I will have a look into this.
One quick question, do you think checking X,y will be accurate enough as if its 1 pixel out, creeping will happen, I haven’t found a snap to isometric grid so I will have to correct any creep myself?
It seems that you want to do an isometric grid movement.
This extension doesn’t handle isometry, but it does a grid movement. If it can help to give ideas.
https://wiki.gdevelop.io/gdevelop5/extensions/pixel-perfect-movement/
Are you trying to make a continuous or a step-by-step movement?
Thanks, for the enemies it’s continuous, I did look at the pixel perfect extension as (forgive the pun} it would be perfect, do you think it would be easy to modify?
It should be, you have to take into account the math and whether or not the condition includes the specified number. For example, if the condition is that the variable X is greater than or equal to 1, it indicates that the condition is true from 1 pixel. If the condition is that the variable X is greater than 1, it is fulfilled from the 2 pixels.
I’m still not sure what your gameplay mechanics would be, so I can’t suggest you precisely. Will the character move freely and have range of motion? Will the movements be through grids like the example I mentioned? is it in turns? Anyway, there are several examples like the ones mentioned to guide you.
I’m not sure, but the extension is written in JavaScript.
Yeah I noticed, does it just pre calculate the destination and pass it on to the top down behaviour?