Old objects messing up code after removed.

Get help using Construct 2

Post » Sun Mar 02, 2014 7:52 pm

Okay, so I just wanted to clean up my code a bit. I had some placeholder enemy sprites that I added to the enemy family and whatnot and was doing some testing with.

I've since moved on to new sprites and left the old ones in just because they had some different code that I might want to reference.

Well, I no longer need them, so I removed them from the family, deleted them from the object menu, and removed all code from the game that referenced them.

But for some reason, the code won't work without them. There's an event that states when all the enemies are killed, that the player's turn comes back on (it's a turn based game). It works fine when there is one "new" enemy left, but with the new enemies gone, the game just doesn't do what it's supposed to.

It works fine if I leave the old enemies in the game... even though they don't appear anywhere or have anything to do with anything.

I just don't understand why the game won't let me get rid of them. Not a single event references them (I searched), the sprites are completely gone, the family is using just the new enemies and not the old ones. There's no reason for this!

Please, does anyone have any ideas why this is before I smash my head through the monitor? I might be able to make a brand new family and replace all the code, but that's a lot of work. This isn't a small game. Besides, I don't want to run into this problem in the future.
B
75
S
30
G
35
Posts: 340
Reputation: 22,896

Post » Sun Mar 02, 2014 11:20 pm

Well, I'm currently replacing the family's boolean variables with global variables, one for heroes being active and one for enemies being active (or maybe just one global variable and use it for both). I hope I can get it working. I've made some progress, but this is still annoying.

I still don't know why the game/C2 got in a twist when I removed something from a family.

Edit: well, I think I have the game fixed using a global variable set to 0 or 1 to replace both the heroes and enemies' family boolean variable. I'm not going to use family variables anymore.
B
75
S
30
G
35
Posts: 340
Reputation: 22,896


Return to How do I....?

Who is online

Users browsing this forum: David181, dop2000, namaewayukidesu and 7 guests