Strange object destruction problem?

For questions about using Classic.

Post » Mon Nov 21, 2011 10:37 am

Hiya everybody,

This problem is really starting to bug me. I seem to run into it whenever I build a game that involves multiple objects and then tries to handle their destruction from a certain condition, and something always seems to stuff up.

Here is a simple side on strategy game project, very bare bones. In it, there are two main objects, player soldiers and enemy soldiers. One type marches across from the left, the other the right. The have a bunch of events that handle shooting, walking, aiming and death. Here's the problem.

These two groups of events, each group handling a different object, should be identical. In fact, I'm almost certain that they are completely identical. However, the "Player Soldiers" do not seem to handle death correctly. As in, technically only the first soldier in the group should be killed, because that's all the bullet could hit. However, every friendly soldier object gets mowed down, not finishing their death animation etc. And yet the other enemy soldiers objects do. Why don't they work the same, even though they are identical?

Would somebody mind helping go through this CAP? You can download it here if you want to help out:
http://dl.dropbox.com/u/48504160/tinywar.cap

Anyhelp would be seriously, seriously appreciated!
B
8
S
2
G
2
Posts: 144
Reputation: 1,588

Post » Mon Nov 21, 2011 11:21 am

With a first look at your cap I noticed that the "on shoot" event (event 25) contained a wrong action. It spawns an "EnemySoldeirBullet" but sets the angle of "SoldierBullet". That last one isn't picked and so all "SoldierBullet" will be randomized again and again with every shoot from one of the enemies.
Also there are targets constantly added without clearing the targets in between.

It seems that with those corrections it works?tulamide2011-11-21 11:22:32
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Nov 21, 2011 11:36 am

Thanks tulamide!

I've fixed it so it changes the angle of the correct object, thanks for pointing that one out. However, what do you mean by targets being constantly added? How can I fix this target problem?
B
8
S
2
G
2
Posts: 144
Reputation: 1,588

Post » Tue Nov 22, 2011 12:13 am

I am not sure if it influences it, or if the behavior is developed with a protection against it, but the target is added to the turret behavior in an always-event:
+ System: Always (every tick)
-> PlayerSoldier: Add target EnemySoldier

There is no need to do so and I don't know if it can cause memory issues over a long period of time, or something like this. Instead you could just add the target in the Start-of-layout-event:
+ System: Start of layout
++ empty event
--> PlayerSoldier: Add target EnemySoldier
++ System: For each PlayerSoldier
--> PlayerSoldier: Set range to 150+random(200)

Of course, this has to be done for both, the player and the enemy.tulamide2011-11-22 00:14:40
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Nov 22, 2011 5:06 am

I see, thanks for explaining! It turns out another problem, and I'm seriously embarrased for not noticing this earlier, was that the player soldiers PV for health was set at 3, while the enemy soldiers were set to 6. Change that, and the battles are more equal. Thanks for all the help tulamide!
B
8
S
2
G
2
Posts: 144
Reputation: 1,588


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest