Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

how to test for block link in game??

This topic is 5243 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi all im working on my first game that is a rip off of "Dr. Robotnics Lean Mean Machine" for genisis but i can''t figure out a good way to test if 4 or more of the blocks are touching(if they''re the same colour) so they disappear... any suggestions? thanx moo

Share this post


Link to post
Share on other sites
Advertisement
Heh I love that game, I guess one way you could do it is to have a 2d array to represent your screen. Each value in the array represents one blob (the value defines what color it is), that way you could check if they are the same color.

Share this post


Link to post
Share on other sites
i have done that already but with a few extra details but im trying to find a way to actually test when 4 or more of the same coloured blocks are touching. like i cant think of a clear enough way to test for this...
i was wondering if storing a count on the number of blocks touching until it >= 4 was worthwhile...
ive also thought about testing as each block hits another and if it is the same colour then test that block and see if its touching another of the same colour and so on...
im just not sure on what is the best way and HOW to implement it...
by the way i like the Japanese alternative "Puyo Puyo 2" i find it much more fun and challenging

thanx

[edited by - the_moo on January 13, 2004 8:38:55 AM]

[edited by - the_moo on January 13, 2004 8:39:59 AM]

Share this post


Link to post
Share on other sites
Pseudo-code:


Have a second array the same size of your playfield.

for every set blob in your playfield do
Initialise second array to zero.
At blob location set second array field to 1

boolean bFound = false

LocalIterator = 1



do
bFound = false
for every value equals LocalIterator in second array do
if blob above my position the same color
set value in second array to LocalIterator + 1
bFound = true
if blob below my position the same color
set value in second array to LocalIterator + 1
bFound = true
if blob left of my position the same color
set value in second array to LocalIterator + 1
bFound = true
if blob right of my position the same color
set value in second array to LocalIterator + 1
bFound = true
increase LocalIterator by 1
while ( bFound )

count how many fields in second array are set greater than zero
when greater or equal to 4, remove blocks


[edited by - Endurion on January 13, 2004 9:01:17 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!