D
Darkwing
Guest
Hello all,
I am creating my own game from scratch (my second one) and this one is pretty ambitious. I have solved multiple hurdles already but I have one which is stumping me. I have made a way to build a spaceship with individual object parts and then control that ship as if it were a single unit, while remaining individual objects with their own stats like HP, energy drain, weight, etc..., but if an object is destroyed and makes some other objects become disconnected, I want them to actually become disconnected, no longer controllable or having their stats influence the ship controls.
My idea was to give each object the variable "connected" and set it to 1 when created. Then, upon the destroy event of any object, create the object "connection check" which would only serve as a trigger for each object except the cockpit to set its variable "connected" to 0. Then have some script that says if "connected" = 1, check one cell above, below, left, and right and if a solid object exists, set its variable "connected" to 1. Then repeat that last command like 100 times or something so that each repeat it connects all objects outward from the cockpit. But it doesn't work.
I have been scratching my head for days trying to figure out how to make this work and I couldn't find anything on the forums regarding this. I am still kind of a n00b at programming so ELI5 if you got any suggestions on how to do this. I cant give away too many details because this game is gonna be awesome and I don't want anyone ganking my ideas before I can put it all together. I am really slow programmer and my last game took me 10 yrs lol so I have my reasons.
Anyways, thanks for any and all help!
I am creating my own game from scratch (my second one) and this one is pretty ambitious. I have solved multiple hurdles already but I have one which is stumping me. I have made a way to build a spaceship with individual object parts and then control that ship as if it were a single unit, while remaining individual objects with their own stats like HP, energy drain, weight, etc..., but if an object is destroyed and makes some other objects become disconnected, I want them to actually become disconnected, no longer controllable or having their stats influence the ship controls.
My idea was to give each object the variable "connected" and set it to 1 when created. Then, upon the destroy event of any object, create the object "connection check" which would only serve as a trigger for each object except the cockpit to set its variable "connected" to 0. Then have some script that says if "connected" = 1, check one cell above, below, left, and right and if a solid object exists, set its variable "connected" to 1. Then repeat that last command like 100 times or something so that each repeat it connects all objects outward from the cockpit. But it doesn't work.
I have been scratching my head for days trying to figure out how to make this work and I couldn't find anything on the forums regarding this. I am still kind of a n00b at programming so ELI5 if you got any suggestions on how to do this. I cant give away too many details because this game is gonna be awesome and I don't want anyone ganking my ideas before I can put it all together. I am really slow programmer and my last game took me 10 yrs lol so I have my reasons.
Anyways, thanks for any and all help!
Last edited by a moderator: