what's the best way to optimize my events

0 favourites
  • 5 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Hi

    i kinda need help on how to optimize my events is there a better way to do this.

    Thanks in advance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Optimization it's not something simple that can be done by removing or switching position of few events. It takes a lot of knowledge and experience to do that. And in most cases that means start all over again.

    Looking at your capx I can see straight away that groups "Control 1..." to "Control 4..." are basically doing same thing. So here's your first thing that should be optimized.

    Same goes to group "1", "2", "3" and "shooting", "shotgun2", "hk"

    Do not repeat same event's every time you need to change few things, learn how to use functions - you could get your project from 100 event to probably 30-40.

    You are still learning so don't be afraid to delete everything and start over from scratch using different methods.

  • about the controls each one contains different animation i ran into problem where the player collide with the pistol sprite than for example collide with the shotgun it will switch the weapon but the animation won't play that why i created a group for each weapon.

  • It's quite doable and pretty easy to do. But with your current setup I really advice you to start over and try different things, cause you start to have problems while adding new stuff to your projects

  • Here I got it down from 96 to 37 but there is more that could be done. e.g. use a Family for the sprites, but I don't know if you have the full version. Also I use Functions a lot normally, but I didn't bother here.

    Main things are:

    1. Use arrays. Don't store values directly in your events. Then instead of If x is 1 do this else if x is 2 do that, etc. you can just have one line using x as an index to an array. In my file I've used multiple 1D arrays but you could use a 2D array as well. You could also load the values from JSON but I've just directly coded them on startup.

    2. Look for repeating patterns in your events, and factor out the common stuff (then see point 1)

    3. Use states (e.g 0=idle, 1=running) and act on the states, not directly on the player actions.

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