Hey, I have a question for the 64d crowd. I consider myself an experienced GMer but I have failed to learn about data structures. So I decided that I would teach myself. I'm starting with grids, and I am making a game like bejeweled. So far so good, I've gotten it to relate the type of gem to the grid place but I need some help with something.
How do I quickly check for gems in a combination. I pretty much need it to check for 3 or more in a row or column or diagonal. This sounds really, really tough and I have made a script that sorta does half of what I want:var i,ii;for (i=0;i(lessthan)ds_grid_width(global.grid);i+=1)for (ii=0;ii(lessthan)ds_grid_height(global.grid);ii+=1){if ds_grid_get_max(global.grid,i,ii,i+2,ii) != 0if ds_grid_get_max(global.grid,i,ii,i+2,ii) = ds_grid_get_min(global.grid,i,ii,i+2,ii)return 1;if ds_grid_get_max(global.grid,i-2,ii,i,ii) != 0if ds_grid_get_max(global.grid,i-2,ii,i,ii) = ds_grid_get_min(global.grid,i-2,ii,i,ii)return 2;if ds_grid_get_max(global.grid,i-1,ii,i+1,ii) != 0if ds_grid_get_max(global.grid,i-1,ii,i+1,ii) = ds_grid_get_min(global.grid,i-1,ii,i+1,ii)return 2;if ds_grid_get_max(global.grid,i,ii,i,ii+2) != 0if ds_grid_get_max(global.grid,i,ii,i,ii+2) = ds_grid_get_min(global.grid,i,ii,i,ii+2)return 4;if ds_grid_get_max(global.grid,i,ii-2,i,ii) != 0if ds_grid_get_max(global.grid,i,ii-2,i,ii) = ds_grid_get_min(global.grid,i,ii-2,i,ii)return 5;if ds_grid_get_max(global.grid,i,ii-1,i,ii+1) != 0if ds_grid_get_max(global.grid,i,ii-1,i,ii+1) = ds_grid_get_min(global.grid,i,ii-1,i,ii+1)return 6;}I really have no way to test this and I need some outside help. If JakeX is feeling particulaly gracious he might help me out because I know he did this in ColumnsX.Any help is much appreciated and would get me one step closer to releasing the WIP. Not that anyone would really care, but the feeling that you just helped someone would remain in your heart [:)].Thanks for atleast reading this.
Why all those stuff, wouldn't it be simpler to check if there are cominations in the cells relative to the actuall one?
Like x=1y=10if (ds_grid_get(x-1,y)) //left cell to the actuall oneif (ds_grid_get(x-1,y-1)) //Diagonal-left cellif (ds_grid_get(x,y-1)) //Cell in top of this oneYou get the point.*sniff* I fell really stupid.
I guess it was just one of those days…meh. We all have those days. (like today for me)
Oh, and I've made a Bejeweled clone. It's in my Showcase.
Ah, data structures are useful.
I really gotta code a proper code block tag…Melee, make a code tag that simply tusn the spaces into nbsp; chars. It would be useful for many people here…
Hey, so far I've gotten it to KINDA work, but it still is really messed up. I am using something like gml_josea's code but with a few minor changes. My current problem is that it checks outside of the grid for things bordering it.
ColumnsX doesn't use fancy datalists. Rather, it uses the instance_position() function, which returns the id of the instance of a specific object at the specfied position. Surely you can figure out the rest yourself?
HAHAHAHAHAHA!!
I laugh at myself for not seeing that function in the first place. I think I assumed it was like "place_meeting()" and just checked, and didn't return anything special.Thanks JakeX, thats what Mods are for :)not what admins are for?