Hey all, I've been working on a platforming game for a while now and I've been looking over a couple different ways of doing collisions, gravity, friction. From what I've seen most people set up an object to object collision system with scripts for different types of collisions. Basically each object has some code or a script in it that is used to tell the object how to collide with other objects, and most objects also have some code for gravity, telling it when to fall and at what speed.
I recently thought up an idea which I haven't seen done yet and I was wondering if I could get a bit of feedback on it. My idea should cut out a lot of unneeded code, basically, have three main objects: ctrl_nature, par_active, par_solid.
- Par_active would be a parent object for every object that can be moved, such as the player or a box you could push around.
- Par_solid would be any other normal solid object.
- Ctrl_nature would handle all the basic collisions between par_active and par_solid.
By putting "with (par_active)" in the step event of ctrl_nature you can put all the collision code or scripts you'd normally have in every object into one. As for gravity/friction you can simply create global variables for the two in ctrl_nature and have the basic code to control it in the step event within the "with (par_active)" section so that it applies to all the of objects with par_active as the parent.
So, does anyone know of any downsides to doing the collisions, gravity, etc. in this way? So far the engine I've been working on that uses this system for everything has been doing rather well, the only problems I'm having are normal bugs you'd have with any type of collisions. Any advice or suggestions on doing things this way?
Edit: Started a page under the projects and added a
download for the basic movement, please let me know if there are any bugs or anything strange about the movement, so far it seems to work rather smoothly though.