Advertisement

relinquish controls

Started by April 23, 2002 09:01 AM
5 comments, last by edwinnie 22 years, 7 months ago
as usual, i am still in the midst of makin tetris cloney. i was thinkin abt tis> if a block known as "crystal_L" is being played, lets say, it is dropped,...collsion...blah blah, next, is the generation of a new block. If the next block is the same block, that is another "crystal_L", how do u relinquish control from the previous block and give it to the new block? (well...i noe how to do it if it is a different block)
What sort of structure is your block object? Do you create blocks dynamically or reuse the same one? Are the blocks self contained structures?

Maybe post a little code, because it''s difficult to answer such an open ended question!
Advertisement
okie, i forgot to tell u that i am using Lamothe''s code
provided in TOTWGPG.

wat u mean by "create dynamically"?
You should have a general class/struct for a falling block - like a specialized "Bitmap Object", as Lamothe refers to them. When the block is finished falling and is becoming part of the stack, you need to refill the block class/struct with the parameters of the new piece (xpos,ypos,speed,type,whatever).
All you really need is one moving block struct/class at one time.

I''m not sure how you organize your stack, but before you refill the block class/struct you should somehow transfer it''s info into building the stack.
No, Canadians DON'T all live in igloos. They live in one BIG igloo!
how does the falling block become "part of the stack"?

new thoughts>
all i do was > to have a 2x2 array as the playarea, using
create bob to create it. I oso HIDE_BOB()
for this playarea.

> then i use > create bob
> load the frames ..set position..blah blah

> when the block falls, it does collision bobs test, with
both the "shown" the playarea bobs.

> so after the falling block hits something, the falling block
will go into hiding(HIDE_BOB). And the playarea that has the
block over it will "show" some of its array''s blocks.

> now that the falling block has gone into hiding,
i will generate a new falling block,
but it may generate another falling block of the same
type.

> so is it that both falling and fallen blocks can be moved,
just that i do not see the fallen block coz it is hidden?

> if this is the case> would it be wise to use the CLONE_BOB()?

Try looking at the problem a different way, instead of hiding the type of block, try hiding the instance of the block, regardless of the type. I won't give you the code, but I think you will be able to do it with what you already learned in the rest of the program.

[edited by - catfoodgood on April 23, 2002 9:54:46 PM]
Advertisement
okie, i just rewritten in terms of single blocks.
should work now.

[edited by - edwinnie on April 23, 2002 12:39:24 AM]

This topic is closed to new replies.

Advertisement