This project has moved and is read-only. For the latest updates, please go here.

Leaving some fields in Geomtry?

Mar 10, 2008 at 3:55 PM

I am new here and i started a small game to test Farseer!
Now i have some pictures of tetris blocks and i want to leaves some blank fields:


I want all - to be not in the geometry var and that new blocks can be put in there!

Chris @lias XNAFreak

PS: I am a german 14 years old child, so please excuse my faults!
Mar 10, 2008 at 5:39 PM
Sorry. I'm not sure what you mean by 'fields' or 'geometry var'. Could you reword these? I gather that you are making a Tetris game. If so, you probably don't want a real physics engine. A physics engine will make the blocks begin spinning if they aren't balanced, and some may even bounce. If this is what you want, then that is fine.
Mar 11, 2008 at 1:41 PM
Edited Mar 11, 2008 at 3:37 PM
Look at the second block in this picture for example:

The block looks like this:
Mar 11, 2008 at 1:41 PM
Look at the second block in this picture for example:

The block looks like this:
Mar 11, 2008 at 5:18 PM
This sounds fun.

OK, I reccomend hard-coding in the geometries. The 'T' shaped one, for example may be given ten verticies at: (-1,-1.5) (-1,-0.5) (-1, 0.5) (-1, 1.5) (0, 1.5) (0, 0.5) (1, 0.5) (1, -0.5) (0, -0.5) (0. -1.5) Assuming each 'block' is 1x1 in physics units.

Actually, now that I think about it, those vertex positions could be tweaked. The ones above put the center point right in the middle of the bounding box. You probably want to find the center of mass, and reposition it so it the 3 bricks are heavier than the 1 brick when the 'T' is on its side.
Mar 12, 2008 at 8:31 AM
Can you please explain me those vertices? I don't know what they are!
One square is 64*64 pixels great.
Aug 19, 2008 at 12:14 AM
Sorry to bring up an old thread. But I hope that XNAFreak does not leave without a good answer. (besides the one Yota gave).

@XNAFreak - Tetris with physics is certainly not something you see every day. Tetris might not be the best game to test a physics engine with.
A suggestion to what might be a good game to test the physics engine is a 2D helicopter side-scrolling game or something like mario.

To answer your question:
The vertices that Yota gave your is the points that maps out the corners of the shapes. The first shape (in the upper left corner) has 4 coners, the next (to the right) has 8 corners. When you map those out in the physics engine, then the engine knows what the shape looks like.

I do have a polygon mapper that you can use to map out the coners. I would suggest that you cut out every shape and put it into a picture file for it self. This makes the mapping easier.
Give me a personal message by clicking on my name, if you want the polygon mapper.