Game Development Community

Still collide with no reference?

by Jeremy Tilton · in Torque Game Builder · 03/15/2005 (7:14 pm) · 2 replies

Ok, so I'm working on tetris. I got controllability working, and a clever way of forming objects by mounting 4 small blocks in some pattern. Everything works fine....for the first object. I need some conceptual guidance...what happens after a shape collides with either the bottom, or another shape?

All my controls are based off of my main piece reference ("$piece"). The other mounted blocks simply follow it around. I figured that after an appropriate collision, I could simply reassign "$piece" to a new object created at the top of the screen. In my opinion, I don't need to have a specific reference to an object that isn't moveable anymore. But this begs the question of whether or not all of its data (including collision info) is removed when I reassign the variable name and "forget" about the old piece. The sprite remains, yet my "echo" statment in my collision callback never gets called when future pieces collide with the old one. Should this implementation work theoretically?

#1
03/16/2005 (12:26 am)
In my Biplane Battle game, I use a loop to create some random ground sprites. After I've drawn one sprite, I just reassign the %ground datablock to hold the sprite, position and collision info of the next sprite and keep doing this until I've placed all of the ground sprites.

The collision polys remain in place after the reassignment, otherwise you'd only ever be able to crash into the last ground sprite that gets created.
#2
03/16/2005 (4:37 pm)
So then when you collide with another object that has since lost its reference, you can regain a reference to that object in the onCollision callback?