Please help

Fill this out this info to make it easier for the community to help you! If you don’t fill out this information, your post may be deleted or removed.

What Wick Editor Version are you using?
Ex. 1.16.3

Describe the Problem
I cant get the grid perfect

What have you tried so far?
changing the values

Do you have a Wick Editor File that we can see? Optional*
My Project9-27-2021_12-27-17.wick

You should explain more… so people can help you…

I think I know what your looking for

To find the grid square closest to the player, let’s first take set the position to that of the player’s

this.x=player.x
this.y=player.y

Next step is to divide the value by the size of the grid squares (in this case, it’s 48 I’m guessing)
Then, if the X and Y values are a multiple of 48, you should get a whole number, otherwise, your gonna get a decimal value, so make sure to round the results.

this.x=Math.round(player.x/48)
this.y=Math.round(player.y/48)

Lastly, the values should be easily multiplied again by 48 to get an X and Y value that is a multiple of 48… in other words, an accepted X and Y on the grid

this.x=Math.round(player.x/48)*48;
this.y=Math.round(player.y/48)*48;

This should work, and you could add more to the X/Y results and play with these numbers to suit this project :+1:

As a side note, the point (0,0) is a center for a square, so you may need to make some adjustments to the code to make it suit the minecraft blocks (such as add 48/2 aka 24)

If this wasn’t what your looking for, then do let me know

It might, and it might not… that is why I ask for clarification so people can help him better…

2 Likes

from my understanding, it’s that the ground isn’t gridded perfectly.

I have no idea how to help, other than to just align them…

also, why do you just dump player1 to the side? why not just remove it properly?

this is good the thing is the code puts it i little bit in the ground and a bit in the air. can you send a demo of it

so I fixed it but I cand get it to delete a block you click My Project9-27-2021_22-28-09.wick