Small Game, Big Lag

0 favourites
  • 3 posts
From the Asset Store
Jump over the small square and avoid hitting it as long as you can!
  • Hello,

    I've created a very simple game, though a bit of an update from the original Space Wars. I've tried to condense everything as much as possible, using families and such, but for the life of me, I can't figure out why certain objects on my 2nd Layout are constantly populating and slowing down the game. Below is a link to the .capx file, so hopefully that will help. Be warned, I have not yet finished cleaning things up, but at this point I don't feel like it should be as bad as it is.

    Problem: Lag when playing the main game, layout 2

    This is my first game with Construct 2, so still a lot to learn. Any help would be greatly appreciate, thanks!


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Events 4 & 10

    Are you aware that the events run FPS times per second ? .... top-down.

    One run trough the event sheet we call a 'tick'.

    So your game starts. And in the first tick it creates those ships depending on player(1/2)choice.

    The next tick, player(1/2)choice is unchanged. Hence, those events are still true. And it creates again those ships.

    The next tick it creates more ships ...

    And more .... and more ... and more ...

    Run it in the debugger and watch the object count run out of control.

    Easy solution ...

    or 1/ add System > condition> 'Trigger once while true' to each event containing that 'player(1/2)choice = ?" conditoin.

    or 2/ just change the value for player(1/2)choice to something like 9999 after it is for the first time used

    or 3/ deactivate both groups after they ran once ... System > action > 'Set group active'

  • Holy crap, I can't believe I didn't catch that!! THANK YOU SO MUCH!

    Usually I choose solution #2, I'm in disbelief that I didn't do it this time around.

    Thank you, thank you, thank you!

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