Layouts not loading properly anymore.

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Im clicking a sprite and an event will trigger, everything in the event will work except loading a layout, but it works on the second click.

    other events the load layout wont work at all but everything else in the event does.

    this never happened before.

    i tried uninstalling all addons but it is still happening even on old saves.

    any one have any idea why this might be happening?

    EDIT: It seems to be somthing to do with the draw calls, all sprites seem to be destroying themselves and coming back constantly but i dont have any code that can do that as far as i can see but il keep looking.

    EDIT 2: It was somthing to do with a particular layout, i have no idea what but when i bypass it everything works fine.

    there were no create or destroy commands anywhere for these sprites and i checked to see if the layout could be closing and re loading or somthing like that but i really dont think it could be possible.

    anyway like i said i bypassed it but if anyone has any idea what could have happened let me know because i feel like knowing what went wrong could really help.

    il see if i can upload the project just incase anyone is interested or bored.

    EDIT: i deleted most things so it goes straight to the problem when previewed, just ignore all the sprites and global variables, like i said it was the start of a game before.

    ufile.io/fxv6ttn6

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Because event nr.6 calls the classicgamedeath function on every tick.

    You can easily debug things like these yourself by adding an event at the very top of your event sheet. Then add a breakpoint to it and start a debug preview. It will hit the breakpoint right away, so you can continously click on the "step" button in the debugger, which will then visually show you where the code is currently at inside your event sheet.

    That way you can spot issues like these very easily.

    https://www.construct.net/en/make-games/manuals/construct-3/project-primitives/events/breakpoints

  • Thanks, break points will be very useful.

    I looked back at my old project file and that event isnt causing the problem, im not sure what i was thinking when i made that example, i was tired and didnt double check it.

    While i was looking i still couldnt figure it out using break points.

    Just incase you wanted to look i uploaded the file here, its alot to go through for someone else so i expect nothing.

    ufile.io/7hwygxc6

    Its the very start of a game remake so its all over the place but to recreate the bug you do the following.

    open the project

    run project in debug mode

    click the new game button

    move left with A (on the keyboard) until you are infront of the green classic sprite

    stop and jump using space (on the keyboard)

    then when the game start walk off the platform to kill yourself.

    this is when the cpu/drawcalls go up

  • Again same issue.

    In that specific scenario, on your Event Sheet "main", the event nr. 113 conditions stay true even after death. So it calls the "classicgamedeath" function on every tick. Means you reload the "deathscreen" layout indefinitely until you clicked that button for the first time, which is the last time the deathscreen is reloaded. Thus the second click will actually work as you escaped the endless loop.

    Note:

    All events with an arrow "On xyz" (including functions), are triggers. These only execute when that specific event is being triggered/called. Otherwise they are entirely ignored.

    Everything else, will run ON EVERY TICK. Even without specifically setting the event "On every tick". The "On every tick" event is actually redundant. That's just there for beginners, although i believe it causes more harm and confusion than anything else.

    So basically the game runs your entire event sheet, on every tick, all events from top to bottom, unless those triggers i mentioned before.

    "Trigger once", which you also seem to have been testing with, is also a beginners trap as it may behave differently than you would expect.

    One way to prevent something like this is utilizing Groups. You put these events into a "death" group, and deactivate the group when these conditions are no longer needed (after death) so on the next tick they are ignored. And reactivate the group when your player is back alive. Which is also performance friendly as all these event conditions are entirely ignored when deactivated.

    Or just refactor those nested events, so when your character dies it only calls the action once.

    Or you split the event sheets, so each layout has its own event sheet, only including event sheets that are required. For example the deathscreen should not need to run actual gameplay logic at all, it only needs to know certain variables which could be imported from a core/variables event sheet.

  • Thanks for all the info.

    I looked at that event alot and i tried changing a few things but obviously i kept missing it.

    i thought that because the player1 sprite had been destroyed it was no longer below the destroy line and shouldnt be triggering, this is what i thought i checked.

    I know about alot of that stuff but i had alot of trouble with de-activating the groups before so i thought i would try somthing else.

    Thank you for taking the time to help me learn, i really appreciate it.

  • The last two paragraphs are what im trying to get used to at the moment.

    Alot of things dont seem to work how i expect them to but i get better every week.

    Ive been doing this for about 7 months now and my previous experiance was the game maker in little big plannet 3 and making music on DAWs so although the skills transfer its quite different.

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