How do I figure out why some actions are being bypassed?

0 favourites
  • 4 posts
From the Asset Store
Alot of High Quality Items sound effects for your game!
  • Hey guys.

    I am facing some trouble with the following:

    I have two functions: One called when the player takes damage, and another called when it is game over.

    When the player takes damage, if there's still hp left, everything goes back to normal, if there's no hp left, the game over function is called.

    This is the game-over sequence from the function.

    The funny thing is.: When I call the function by itself, it works just fine. But running the code displayed above with the conditions for when the HP gets equal or below 0 (in other words, if the player dies regularly by taking damage in game), the code just ignores everything related to create the 'bg_color_fullscreen' object and only deals with the code related to the player character.

    This is what is happening by getting a game over 'normally'

    straight-up calling the game over function works as intended.

    I tried fixing this for so many hours, but I haven't found the faintest lead on how to solve this.

    Could you guys help me on this?

    Thanks in advance.


  • I can't see any problem with the events, I mean there shouldn't be any if you're calling the same function each time. If you could share the project then maybe can work it out but from the screenshots it looks fine.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was preparing a file to share, but after erasing some 'unecesary' stuff, I tested the file and the game over function just worked as it should be.

    After this I started to look at what I removed, trying to pinpoint the issue, and then I found this in another event sheet, related to some boss events

    My biggest mistake was not thinking thoroughly about all of the related elements that needed veryfication...I inspected everything related to the player object but not the problematic object itself...

    Now I know the source of the issue, since disabling these bits of code makes the game over function work fine... I need to think on how to solve this.

  • I think I have worked it out - that object probably has 0 opacity in the editing view as you set it to 100 for the boss, but you don't set it to 100 game over. If it is created with 0 opacity and you don't set it to 100 then it is destroyed immediately. That's my best guess.

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