Ive done this game.
What i did was to iterate from the center to the right and
moving all
columns with a free space to the left of it.
Then I did the same with the left side.
Do this until you dont have any gaps left.
Everything will be centered but columns will not have to
move if they
dont have to.
/Nisse
Paul Steven skrev:
> Thanks Alan
>
> I do already have all the blocks falling using a
similar method to what you
> suggest.
>
> I just could not work out what the logic was for the
horizontal movement. It
> seemed like sometimes the left side would migrate to
the right to fill empty
> cells whereas other times, the right side would migrate
to the left.
>
> Anyway I think you have given me a new direction so
many thanks!
>
> Hehe funnily enough your book just arrived yesterday so
I will be sure to
> reach for this now off the shelf.
>
> Cheers
>
> Paul
>
> -----Original Message-----
> From: dirgames-l-bounces nuttybar.drama.uga.edu
> [mailto:dirgames-l-bounces nuttybar.drama.uga.edu] On
Behalf Of Allen
> Partridge
> Sent: 13 March 2007 14:55
> To: 'Director - Shockwave - and Flash Game Production'
> Subject: RE: [dirGames-L] Collapse game logic help
>
> I haven't done this particular one, but I'm wondering
if in this case it
> wouldn't be better to use an object approach rather
than the standard list
> method.
>
> The exact behavior is that blocks shift either down or
toward the center in
> order to fill gaps. If the cup center is a 2x2 table,
storing data to refer
> to the type of block in the slot (or 0) if no block is
in the space.
>
> Theoretically then, the problem is to parse the table
starting with the
> bottom row, looking for vacant spots. (zeros)
>
> You'd want to do vertical rows first, though because
blocks prefer falling
> over sliding. Hang on... checking again. Yes. So first
check each column for
> blanks, then check each row.
>
> I did similar work in my "Casual Games" book
(blatant plug
> http://www.amazon.com/Creating-Casual-Games
-Profit-Fun/dp/1584505192/) for a
> match 3 sliding game. This however adds the variable
of the sideways
> sliders, whereas that just accommodated falling
blocks.
>
> The principle is basically the same however. You just
parse the columns for
> blank spots and then let each blank spot inherit the
properties of its
> parent from above to do the initial fall. (make sure
you update the table
> data after each change -- but you'll also need the
original position data to
> trigger the animations.)
>
> Then go through and update the horizontal (rows) only
instead of making all
> fall to the bottom row, you're making the left side
migrate right to fill
> empty cells - the middle and the right side migrate
left to fill empty rows
> toward middle.
>
> Add a test for all clear and a spawner to generate new
rows up -- note a
> reverse of the spawner would let you load the initial
table.
>
> I think it might be just as easy to imaging lingo the
cells, rather than
> fuss with sprites - but you can do it with sprites.
>
> Hth,
>
> --al
>
> -----Original Message-----
> From: dirgames-l-bounces nuttybar.drama.uga.edu
> [mailto:dirgames-l-bounces nuttybar.drama.uga.edu] On
Behalf Of Paul Steven
> Sent: Tuesday, March 13, 2007 8:14 AM
> To: 'Director - Shockwave - and Flash Game Production'
> Subject: [dirGames-L] Collapse game logic help
>
> Sorry if this is a really basic question but I can't
quite figure out this
> one...
>
> I am making a game similar to this one
> http://www.shockwave.com/content
Play/shockwave.jsp?id=sbcollapse&memberStatu
> s=NotSignedIn&brand=clubhouse
>
> In this game, when a column becomes empty the other
columns move to fill
> this gap.
>
> Now I am having real trouble working out what the logic
is here. It seems
> that sometimes a column will move from the left to fill
a gap and sometimes
> a column from the right will move to fill the gap and
sometimes columns from
> both sides of the gap will move.
>
> I am sure there is some logic here but I cannot work
out what it is doing. I
> initially thought it was always ensuring the solid
columns were always being
> centered so thought it was simply a case of
representing the columns as an
> array and stripping out all the empty columns and then
repopulating the
> array on with zeros around the solid columns.
>
> e.g
>
> [1,0,0,1,1,1,1)] would become [0,1,1,1,1,1,0]
>
> If anyone can explain the logic here I would be most
grateful.
>
>
> Thanks
>
> Paul
>
> _______________________________________________
> dirGames-L mailing list - dirGames-L nuttybar.drama.uga.edu
> http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
>
> _______________________________________________
> dirGames-L mailing list - dirGames-L nuttybar.drama.uga.edu
> http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
>
> _______________________________________________
> dirGames-L mailing list - dirGames-L nuttybar.drama.uga.edu
> http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
>
>
>
_______________________________________________
dirGames-L mailing list - dirGames-L nuttybar.drama.uga.edu
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames
-l
|