Can you see problems with my code?

  • lennaert

    OK, so I think I did what you told me too and the walker movement still lags. Here's what it looks like now, does everything look right?

    <img src="https://dl.dropboxusercontent.com/u/60595907/Screenshot%202014-01-03%2014.57.40.png" border="0" />

  • You could try and add instance variables to the walker, so the set animation doesnt get set every loop.

    like, add instance boolean variables: walking = true, and attacking = false

    set them accordingly, like, in the first sub, once its walking, set the variable walking to true.

    to the distance check, add a check for the boolean is walking, and invert it.

    Now, when its bigger then 200, and boolean is walking = false, it will set the animation to walking and the boolean to true.

    Do the same principal for the attacking.

    In short: by means of boolean sets and checks, prevent the spriter animation from being set every loop.

  • Man, this is tougher than I thought it would be. I had an older build where there didn't seem to be so much processor used with basically the same events. Not sure why it changed so much. Thanks for your help, I'm working on it!

  • lennaert - thanks for your help. I played around with your suggestions for a while and I was still having the heavy processor draw from the Walker movement so I made a rectangular sprite to represent it. Now it uses hardly any processor, regardless of how many instances there are on screen. Now I'm trying to get my Z order right again and make them move independently but, so far, it's a great improvement.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • great to hear :D

    So you have a problem with the spriter image itself ?

    if you get stuck with the problem, just ask around on this forum for helps with the scon files, I've got spriter too, but not much experience there yet, but a lot of other visitors on scirra do :)

    Lennaert

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