I have game idea, please make it for me...
Moderator: Moderators
Re: I have game idea, please make it for me...
oops... I didn't notice you post... I worked it out to r.sqrt(3) which was right (my circles have a radius of 50 and the offset of each row is ~86.6 so I've used 87)...Beherith wrote:sqrt(2)/2
and I don't see what "sqrt(2)/2" is supposed to mean... where's the variable?
Re: I have game idea, please make it for me...
whoops, my bad, it is sqrt(3). Height of equilateral triangle. so the answer is sqrt(3). You get no variable because you asked for ratio.
Re: I have game idea, please make it for me...
Ambigious question.SinbadEV wrote:what is the ratio of vertical offset to radius for the second row in a hexagonal latice?
1) What kind of hexagonal lattice? There are two non-retarded orientations:
Do you mean:

Or

2) Which second row do you mean? The second row that is vertically aligned, or the second row that closer but shifted?

Or

The answers are 5/2, 3/2, sqrt(3), sqrt(3)/2.
You asked for a ratio. For the ratio h/r. So there is no r. Ask about h expressed in function of r if that is what you want.SinbadEV wrote:where's the variable?
Re: I have game idea, please make it for me...
Now I feel bad for having figured it out before people gave me intelligent responses... thanks for the effort anyways... and @zwzsg since you know what I'm talking about, do any of the mentioned numbers come out to finite ratios for the "closer but horizontally offset next row"?
also, I had forgotten I was asking for a ratio... I get it now.
edit and attachment:
This is the grid I'm using right now...

To move around the grid you have 6 directions
NW = Up
NE = Up-Right
E = Right
SE = Down
SW = Down-Left
W = Left
also, I had forgotten I was asking for a ratio... I get it now.
edit and attachment:
This is the grid I'm using right now...
To move around the grid you have 6 directions
NW = Up
NE = Up-Right
E = Right
SE = Down
SW = Down-Left
W = Left
- Attachments
-
- HTML5HexGrid-Simple.PNG
- (25.99 KiB) Downloaded 1 time
Re: I have game idea, please make it for me...
In case you were wondering how freaking fast javascript is, check out my test page... it does the following every time you move your mouse:
and there is no perceptible lag
edit: and don't bother pointing out that a bunch of the stuff it's doing is redundant... I've fixed it, it looks like this now
Code: Select all
function intersects(x, y, cx, cy, r) {
dx = x-cx
dy = y-cy
return dx*dx+dy*dy <= r*r
}
function mouseMove(e)
{
var mouseX=0, mouseY=0;
if(e.offsetX) {
mouseX = e.offsetX;
mouseY = e.offsetY;
}
else if(e.layerX) {
mouseX = e.layerX;
mouseY = e.layerY;
}
/* do something with mouseX/mouseY */
var coords=document.getElementById("coords");
coords.innerHTML = mouseX+", "+mouseY;
var found = false;
for (x=0;x<x_cols;x++) {
for (y=0;y<y_rows;y++) {
cxt.fillStyle="#000000";
coordText = "("+x+","+y+")";
metrics = cxt.measureText(coordText)
wo = Math.floor(metrics.width/2);
if (intersects(mouseX,mouseY,x*2*r+r+(y*r),y*o+r, r) && !found) {
data.innerHTML = x+", "+y;
found = true;
}
}
}
if (!found) {data.innerHTML = "none"};
}
edit: and don't bother pointing out that a bunch of the stuff it's doing is redundant... I've fixed it, it looks like this now
Code: Select all
function intersects(x, y, cx, cy, r) {
dx = x-cx
dy = y-cy
return dx*dx+dy*dy <= r*r
}
function mouseMove(e)
{
var mouseX=0, mouseY=0;
if(e.offsetX) {
mouseX = e.offsetX;
mouseY = e.offsetY;
}
else if(e.layerX) {
mouseX = e.layerX;
mouseY = e.layerY;
}
/* do something with mouseX/mouseY */
coords.innerHTML = mouseX+", "+mouseY;
var found = false;
for (x=0;x<x_cols;x++) {
for (y=0;y<y_rows;y++) {
if (intersects(mouseX,mouseY,x*2*r+r+(y*r),y*o+r, r) && !found) {
data.innerHTML = x+", "+y;
found = true;
}
}
}
if (!found) {data.innerHTML = "none"};
}
Re: I have game idea, please make it for me...
How many of these threads have you made, Sinbad? You're making me feel inadequate.
Re: I have game idea, please make it for me...
This one is diffrent, he contributed java-code, the usual un-productive pingpong and trolling ended for a moment. Sinbad can do it, i see contribooty. If its good i have the right to steal it.
Re: I have game idea, please make it for me...
due to popular demand I have have shifted my place for posting of crazy ideas to http://sinbadev-benjie.blogspot.com/