tracking number of enemy deaths

0 favourites
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • Hi all,I'm having a issue with my tower defence game and I need some advice,basically when I start a level and clear all the waves,the level is not always ending,sometimes it ends sometimes it does not,

    I have a global variable set up.

    On enemy death add 1 to global number.

    When global number is achieved wait 3 seconds go to layout.

    Sometimes it works,sometimes it does not.

    Can someone please give me a way to figure this out,its really messing up the game experience for the people testing it for me.

  • More information needed to help. Best way would be to share your project.

  • Global variable "enemys dead = 0"

    Enemy health = 5

    Player bullet collide with enemy subtract 1 from enemy health.

    Enemy health =< than 0 destroy enemy add 1 to "enemys dead"

    "Enemy on path arrived"

    Destroy enemy.

    Add 1 to "enemys dead"

    So if 10 enemys are killed and that is = to the global variable "enemys dead"

    I want the level to end.

    it works 80 percent of the time, but then it fails.

    Do you have a suggestion on how to achieve this.

  • Try changing the trigger for ending the level from Enemies Killed = 10 to Enemies Killed >= 10.

  • Thank you for the quick response,I'll try that now and see if it works

  • Ok that worked on the first try,I'll give it a good test tomorrow when I'm working on my game again.

    Thank you.

  • I've had issues in the past when I didn't quite understand how the 'wait' action worked. These days I prefer to wrap things up in a controller and use the timer behaviour event to trigger things like state changes.

  • So are you suggesting not to use wait when my condition is met,is there something I don't know abut wait?

  • After do alot more testing and playing my game in debug mode to track the global variable,it is working fine,the problem seems to be on itch.io not ready my global variable.anyone else having that issue with itch.io

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use wait if it's working for you. I just prefer to have events like layout transitions handled with the timer trigger so that it's a separate event.

    How does itch.io work? I thought it was just a store front. Seems weird that it would only be specific to that platform. Do you have a link that we can look at?

  • Yes as of now the issue only happens in itch.io also itch.io does not save a local highscore after closing the game.can you test one of the levels for me and see if you have the same issue,you can find the game in forum under contruct 3 creations or else search for it on google.

    "Crazy Wars TD"

  • Played about 20 levels then and never got the bug. Cool game too, though those tough robots that show up kill me every time.

  • Thanks the bosses are best killed with barracks towers and mines.

    Why am I getting that bug? I'm so confused,has my browser anything to do with it?

    When I test on contruct I get no bug,but on itch.io my game does not end after the waves are complete for each level,2 other people have told me they also experienced that bug.im thinking to upload my game on another website to see the results.

  • if setting the test to enemy killed >=10 worked then that means your logic is not working correctly as you should never have more than 10 enemies killed.

    its hard to tell without seeing code but it probably means that sometimes your enemies are loosing full health exactly the same time as they are at the end of the path so you are getting 2 added to the enemy killed variable.

    test the enemy killed variable and track when it goes >10

  • That's interesting,I didnt think If enemies were kill at the same time if would not register correctly,I'll try what you said,thank you

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