Strange object destruction problem?

This forum is currently in read-only mode.
From the Asset Store
Strange factory themed set of tiles for your platformer game
  • 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:

    Anyhelp would be seriously, seriously appreciated!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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?

  • 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.

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)