where is the guide, I need the tiles to snap perfectly just like in Gdevelop or godot
Oh, um, make one, idk, im not a Js nerd:point_up:
We know that the screen in Wick behaves like a small grid. With that data, we can divide the screen into quadrants of 16, 32 or 64 pixels (tiles).
Then, we can take individual objects of the same size as the quadrant, and put them where we want.
Example:
NOTE: This system show-cased here is not great. If placed on the frame, it’ll fail to place blocks where there is a block above, and in the block it’ll not work completely.
It also doesn’t feature a system to remove blocks, and changing blocks is also broken.
var gridSize = 16;
function makeShowBlock() {
var showBlock = block_base.clone();
showBlock.opacity = 0.5;
return showBlock;
}
var showBlock = makeShowBlock();
onEvent('update', function () {
showBlock.x = Math.floor(mouseX/gridSize) * gridSize;
showBlock.y = Math.floor(mouseY/gridSize) * gridSize;
});
onEvent('mouseclick', function() {
showBlock.opacity = 1;
console.log(`Placing Block #${block_base.clones.indexOf(showBlock) + 1} at x:${showBlock.x} y:${showBlock.y} mouseX:${mouseX} mouseY:${mouseY}`);
showBlock = makeShowBlock();
});
onEvent('keydown', function() {
if(isKeyDown('space')) showBlock.gotoNextFrame();
});
If you want to make your own system, while thinking that the block’s pivot is centered, use this to align it.
var gridSize = 32;
showBlock.x = Math.floor(mouseX/gridSize) * gridSize;
showBlock.y = Math.floor(mouseY/gridSize) * gridSize;
okay where do I put these scripts
I just gave you the math. Code your own based on this:
first there is a weird bug I cant explain, basically when the player touch the floor it teleports to somewhere where there is no floors
pkplat12-10-2025_13-11-42.wick (9.1 KB)
Sorry, I am not your personal coder. You need to do things yourself to be better at them.
yeah Ik but I dunno how to explain this bug
nevermind
(10)
ok so let me see where there error is in the code
is it supposed to be like this type of game or somthin else
so its suppose to be a demo for my upcoming game for testing out weapons like kunais and shruikens and katanas
well the reason your guy is getting yetted out of the map area or floor is because of a incorrect collision box setup
yeah I stole this template from
ok I did a quick test by placing a line and it did the same thing to that I am not sure its a line in the coding but it is happening every block and or drawing
i found the problem it is teleporting because it thinks its a square no a stick figure this is an easy fix
my screen crashed so it needs to be in a square also it is to big so that’s why is getting yetted
so u fixed it
yea here I will send tyou the file