Can you see problems with my code?

  • Can anyone see any problems in my code that would be using a massive amount of processor power, especially within the "walker movement" category? For some reason, as soon as they spawn they drag the fps way down, each one cumulatively more so. Thanks!

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

  • Couldn't you use the debugger to check what is happening?

    It can show exactly what is taking the most processor time.

  • Would you skype with me for a bit sometime?

  • When I click the profile tab in the debugger it shows how much processor each part of the layout is using. Nothing uses much until I introduce the Walker. I wonder if there might be some kind of problem with the spriter object...

  • I've got the problem narrowed down to walker movement. It's something in the way they move...

  • How many active walkers do you have on one layout ?

    You are firing 2 foreach loops for them every 0.05 seconds.

    you could start by adding 2 sub events to the first for each loop, and move the distance check to the first sub. In the second sub add an else and add the actions from the second loop.

    This way you can delete one of the foreach loops with its checks, which should now get handled by the first loop "else" statement.

    event:

    condition: for each

    sub 1: distance check

          actions: etc

    sub 2: else

          actions: etc

  • It's directly in the set angle of motion to angle(Walker.x,Walker.y,Psi.x,Psi.y) part. I wonder why that's causing so much lag.

  • There seems to be something wrong with my Skype-account..

    I'll remove it from my signature untill I figure out what..

    I don't know much about spriter, so I can't say if using it to this extent could cause issues.

  • It's directly in the set angle of motion to angle(Walker.x,Walker.y,Psi.x,Psi.y) part. I wonder why that's causing so much lag.

    Put that action in the action directly after the for each loop in what I mentioned above. Will prolly solve it :)

    event:

    condition: for each

          action: set angle

    sub 1: distance check

          actions: etc

    sub 2: else

          actions: etc

  • would setting for each walker as topevent above the every x seconds and removing it in the subevents work?

  • would setting for each walker as topevent above the every x seconds and removing it in the subevents work?

    nah then it would only fire once.

  • lennaert how do you insert the "else" function, could you be a little more specific. You're dealing with a true noob here...

  • add event, system event ... I generally then just type the name else, and the selection narrows down to it xD

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • And then what will be after the else? These are both going to be sub events for the man, for each walker set bullet angle of motion even, right?

  • yes, the first sub of the for each should be the distance check, if the distance check doesnt pass, it shold use the actions of the else (the actions that came from the second loop)

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