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?
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?
About the author
#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?
Torque Owner Philip Mansfield
Default Studio Name
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.