View Full Version : Connecting graphics w/ coding

11-25-2002, 10:34 AM
Hey I am a HUGE beginner in OpenGl graphics programming, and I was just starting to get into the graphics and coding involvement area - ex: tetris, showing the blocks move and when 4 of the same, they delete- How can I "connect" the graphix with the code so that it "knows" that there is a match or whatever. Does anyone know that answer to this - HOPEFULLY - and also does anyone know if there are tutorials on information such as that?? If ANYONE could help that would be wonderful!

11-25-2002, 11:34 AM
There are diffrent ways to track a object.

simple test to see if they are in the same space.

if (object_a == object_b) do_something();

Look at learning vector math, it is the best way to learn to track objects in 3D space.

Here is a good website to start with lot's of exmaples and links to other sites.


[This message has been edited by nexusone (edited 11-25-2002).]

11-25-2002, 08:14 PM
Well, you can fake it.

For tetris, I assume that the block cannot be moved freely, but in steps: one width left or right, and one height down. This turns your area into fields. Four fields in width, and for example ten in height. And this solves your problem without having to use complex vector math. Just track in which field certain object is, and in each step check for adjecent fields for their objects.