0 Favourites

What is the better way to use event?

  • Hello there!

    I'm always making games in construct 2 and i like to make a function with a single blank event inside, becouse i can minimize a function to see better all the codes and every function that i have. I want to know if this is a bad thing to do or not.

    Example:

  • I use number 1 just in case in the future I have to put an "if" or "else" statement it will be easier. So go with number 1 so in case you want to make changes to code, its very easy.

  • I use number 1 just in case in the future I have to put an "if" or "else" statement it will be easier. So go with number 1 so in case you want to make changes to code, its very easy.

    Me too, but, do u think this can be make a code be slow and heavy?

  • It will have no effect on speed.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • > I use number 1 just in case in the future I have to put an "if" or "else" statement it will be easier. So go with number 1 so in case you want to make changes to code, its very easy.

    >

    Me too, but, do u think this can make the code be slow and heavy?

  • There is no effect on speed if you do 1.

    You can simply do the performance check yourself by calling a function 1 thousand times using coding via 1 and 2.

  • You can use both. I usually use "1" but I also use "2" for ordered events.

    Performance difference? "None" , both runs the same on export.

    Even if in theory 1 is faster, no one would volunteer to prove it considering it's insignificance.

    Don't focus your time on minor details, my mistake when I was still learning C2 .

  • There is no effect on speed if you do 1.

    You can simply do the performance check yourself by calling a function 1 thousand times using coding via 1 and 2.

    Cool, good to know, thanks!

  • You can use both. I usually use "1" but I also use "2" for ordered events.

    Performance difference? "None" , both runs the same on export.

    Even if in theory 1 is faster, no one would volunteer to prove it considering it's insignificance.

    Don't focus your time on minor details, my mistake when I was still learning C2 .

    I use 1 normaly, but i always get this question... thanks!

  • first is better. 2nd is a subevent which probably causes a minor cpu intruction to change where it reads the next action, and checks for empty condition, while first just executes what it was called for. yes you won't notice any performance loss on such small things, but if you make 10k events game where you wrote every event like that (2nd) you might feel a small performance drop 1-2fps max. and that's going too far anyway.

    i just prefer not wasting space and even every microsecond of processing

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