Hey guys
Im working on a sega columns clone and its coming on pretty well
the method im using has an array for each possible block position ( cubes[x][y] ) which holds a value representing that spaces color ( 0 for empty )
the thing i need help with is thinking of the best way to check for matches in block color in order to take them and allow for the different directions and combos
im coming up with a few ideas but i think theyre all pretty inefficient ways to do it
ill release a demo when that bits sorted
cheeers
Sega Columns Clone - (help checking colors)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Sega Columns Clone - (help checking colors)
http://www.gregkirk.co.nr - portfolio | http://shadowharlequin.deviantart.com - deviantart
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
Re: Sega Columns Clone - (help checking colors)
so far im thinking maybe;
or creating a new array checking[x][y] where checking[2][2] is the color to be checked for matches around it then store the positions of any matches and use them for further checks
Code: Select all
function checkmatches()
checkx = heightcubes
for i = 1, heightcubes do
for i2 = 1, widthcubes do
if (cubes[checkx][i2] ~= 0) then
checkingcol = cubes[checkx][i2]
--Check right
if (checkx <= (heightcubes - 1)) then
--Check down directions
end
--Check upwards
end
checkx = checkx - 1
end
end
http://www.gregkirk.co.nr - portfolio | http://shadowharlequin.deviantart.com - deviantart
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
Re: Sega Columns Clone - (help checking colors)
Awesome, I played that game to death when I was (way) younger. I hope you'll add repetitive and dull music, like in the original.
It has, however, been so long that I can't remember whether you can score diagonally. Can you?
It has, however, been so long that I can't remember whether you can score diagonally. Can you?
Re: Sega Columns Clone - (help checking colors)
yeah you can, they can also join with verticals and horizontal matches too
ive been trying to get it working just for horizontal and vertical but its going a little weird
if it works and i sort out some nice graphics ill be getting my friend to write a pretty mental tune, definitely keep that 'melody' though
ive been trying to get it working just for horizontal and vertical but its going a little weird
if it works and i sort out some nice graphics ill be getting my friend to write a pretty mental tune, definitely keep that 'melody' though
- Attachments
-
- QBZ.love
- (249.79 KiB) Downloaded 230 times
http://www.gregkirk.co.nr - portfolio | http://shadowharlequin.deviantart.com - deviantart
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Sega Columns Clone - (help checking colors)
I had Sega Columns for Game Gear, but I was more a fan of Dr. Robotnik's Mean Bean Machine.
Re: Sega Columns Clone - (help checking colors)
columns all the way, it got insanely quick and you can easily zone out upto level 50 odd
once the prototype is done it should be easy enough to add a few new game types and maybe themes or something
once the prototype is done it should be easy enough to add a few new game types and maybe themes or something
http://www.gregkirk.co.nr - portfolio | http://shadowharlequin.deviantart.com - deviantart
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
Re: Sega Columns Clone - (help checking colors)
you essentially have 4 directions to check, right? horizontal, vertical, and the two main diagonals.
Also: at least three in a row of same color to make a match, but no max length, yes?
something like:
Also: at least three in a row of same color to make a match, but no max length, yes?
something like:
Code: Select all
function checkmatches()
for cubey = 1, heightcubes do
for cubex = 1, widthcubes do
if (cubes[cubex][cubey] ~= 0) then
checkingcol = cubes[cubex][cubey]
--use dx and dy variables to simulate the directions to be checked
for dx = -1,1 do -- (down, right, downleft, and downright)
for dy = 0,1 do
--special cases that don;t need to be checked
if not (dx==0 and dy == 0) and not (dx == -1 and dy == 0) then
local rowsize = 1 --how many of this color are in a straight line so far
while true do
--find the cube that is, rowsize untis away in direction dx,dy
local tempx,tempy = cubex+dx*rowsize,cubey+dy*rowsize
--if out of range, stop now
if tempx < 1 or tempy < 1 or tempx > #cubes or tempy > #cubes[1] then break end
--if same color ,add 1 to rowsize and keep going
if cubes[tempx][tempy] == checkingcol then rowsize = rowsize + 1
--if different color, stop now
else break end
end
if rowsize >= 3 then
--found a row of 3 or more items of the same color!
--do stuff here
end
end
end
end
end
end
end
Re: Sega Columns Clone - (help checking colors)
yeah that looks good, im going to see how it works, only problem is its got to make a note of the coords for the matching colors to change the values to 0 (empty)
http://www.gregkirk.co.nr - portfolio | http://shadowharlequin.deviantart.com - deviantart
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
Re: Sega Columns Clone - (help checking colors)
ok its working pretty well, but a little off, if you notice the x coordinates of 'matched' colors can exceed the gamewidth
http://codepad.org/j19owk6J
copy and past into a new codepad to generate a new grid, it displays the gird then the checking results
if you could give me a hand working out whats gone weird with it that would be awesome, ive been up all night staring at it
http://codepad.org/j19owk6J
copy and past into a new codepad to generate a new grid, it displays the gird then the checking results
if you could give me a hand working out whats gone weird with it that would be awesome, ive been up all night staring at it
http://www.gregkirk.co.nr - portfolio | http://shadowharlequin.deviantart.com - deviantart
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
http://www.myspace.com/shadowharlequin - myspace | http://www.vimeo.com/themilkfactory - music visuals
Re: Sega Columns Clone - (help checking colors)
It looks like when you make the grid you make the y values first, so a specific point should be accessed as cubes[y][x], whereas the rowfinder checks [x][y].. I could be wrong, but I think that's it.
Who is online
Users browsing this forum: Ahrefs [Bot] and 5 guests