dop2000's Forum Posts

  • Yeah, for some reason when you use Physics, jitter happens.

    Although it looks like the sprite moves with constant speed, on some frames its x,y coordinates are not updating:

    X.............dt

    2410 0.016657

    2421 0.016676

    2421 0.016625

    2431 0.01665

    2442 0.016645

    2452 0.016638

    2463 0.016682

    2474 0.016693

    2484 0.016655

    2495 0.0166

    2495 0.016657

    2505 0.016651

    2516 0.016657

    I don't know why this happens, but I'm guessing that's what causing the jitter when scrolling.

    Why are using Physics anyway? With 8-Direction behavior scrolling works perfectly.

  • Wait, I don't understand. Why do you need the second sprite? Is it for scrolling only?

    So the Mech moves smoothly and jitter only happens when you add scrolling?

    Why don't you try this:

    System->Scroll to X -> lerp(scrollX, Mech.X, dt*4)

    System->Scroll to Y -> lerp(scrollY, Mech.Y, dt*4)

    Also, the link you posted if broken.

  • Correct, "time" is different from the system time.

    "time" starts from 0 when the application starts.

  • DolyGamesCosmos

    Firebase is a commercial product (with free plans available) owned by Google, so you can be fairly sure it will continue to work after X months or even years

  • It's not clear from your gifs which object is Sprite and which is the Character?

    Is the movement smooth if you disable Physics behavior?

    You should avoid changing x,y position for Physics objects, directly or with other behaviors like Bullet, Sine etc.

    Ideally physics objects should only be moved using Physics actions like Apply Force, Apply Impulse, Set Velocity etc.

    See this demo for example - the ball is moved to mouse position using impulses (last 3 events):

    https://www.dropbox.com/s/9cdcj8omeurgs ... .capx?dl=0

    Also, to ensure consistent movement on different framerates, use lerp with dt:

    lerp(Self.X,Sprite.X, dt*10)

  • —

    You can download that SVG plugin from github:

    https://github.com/JohnnySheffield/C2_Plugins_Pode

  • You don't have any other AJAX requests or AJAX->"On any completed" in other event sheets?

    I would change "On any completed" to "On 'ScriptLoad' completed" just to be on the safe side.

  • Could you share a screenshot of your events? Just to make sure that you are doing everything correctly.

    I guess you can try a stress-test. Change your code, so that if AJAX loads the file successfully, the game exits. If "On error" is triggered or AJAX.lastdata is empty, display some debug information and don't exit the game.

    Then set up Windows Scheduler to run your game every few seconds. Or create a batch file RunAgain.bat :

    MyGame.exe
    timeout /t 10
    RunAgain.bat
    [/code:c9t5koy0]
  • There are third-party services that can be used to host leaderboards. (Don't ask me how they work though, I haven't tried any of them)

    Here are a few links:

    https://www.scirra.com/tutorials/1465/l ... rse-plugin

    https://www.scirra.com/store/royalty-fr ... ebase-2609

    plugin-firebase_t121776

    plugin-firebase_t91232

    There may be more examples in the Tutorials section, search for "leaderboard":

    https://www.scirra.com/tutorials/all

  • Did you put "Set StartTime to time" at the "On Start of layout"?

    Then yes, it will be very close to 0 when you launch the game. (because "time" starts from 0)

    Every time this layout is restarted, StartTime will be updated to current time.

  • R0J0hound

    You are right, thanks!

    I learned it the hard way that events like "On timer" can sometimes pick several instances, this made me a bit too cautious.

  • The main error is that when you return to "Game Level4" the second time, your variables are not reset. "Level" variable still contains value 4, so event #31 changes layout back to "Screen 5".

    To tell you the truth, I don't understand what's going on in your game, all these layouts constantly changing.

    Screen 5 goes to Level 4, Level 4 goes to Level 2, Level 2 to Level 3, then back to Screen 5, then back to Level 4...

    There's probably some logic to it, but I don't get it.

    Try adding "Set Level=1" at the start of Screen 5 layout. Maybe it will help, but I don't know if this can break something else in your game.

  • Ok, so the first problem is that "Wait 4 seconds, Go to next layout" is triggered twice, you should probably fix it.

    But the reason why Level4 is skipped is event #31 in "Screen 4 Game Levels". When you return to Level4 the second time, Level variable is already 4, so this event immediately changes layout back to "Screen 5".

  • Thanks!

    It's hard to understand the logic behind your events, but I believe the problem is in "Screen 5 ES Q3" at event #6.

    It's triggered two times (probably because the collision happens twice).

    So this code is executed twice: "Wait 4 seconds, Go to next layout"

    As a result, your "Level 4" layout is loaded very briefly and then next layout is loaded, which for some reason is "Screen 5".

    If you open console in your browser you will see it:

    Go to layout: Screen 5

    Go to layout: Screen 5 Q2

    Go to layout: Screen 5 Q3

    Go to layout: Game Level4

    Go to layout: Screen 5

    I suggest you use "Go to layout Game Level 4" instead of "Go to next layout".

    Also, you can add Browser object to your project and use Browser->Log to output debug messages. This is how I found out that event #6 is triggered twice.

    EDIT: no, wait, "Go to layout Game Level 4" doesn't fix it.. I need more time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What I do not understand is why when I refer to an instance variable it doesn't take into account for each individual instance's unique variables. I am under the impression that there is a universal solution for getting the system to make instances behave independently based on their uniquely different variables.

    When you refer to instance variable, the system actually does this "for each picked instance".

    Say, if you do "Gun set var to random(10)", a different random number will be set for each instance of the Gun.

    And if you do "Gun set scale to var", they will all become different sizes.

    As for the Timer - this is not a workaround. This is the right way to do things in C2 when you are dealing with multiple instances and delayed actions.

    If you only have 1 gun, you can use "Every x seconds" or "Wait", no problem.

    If you have multiple instances of gun and they are firing/reloading at different times, it may be really difficult to get them working correctly with all these "Every x seconds", "Trigger once" and "Wait" events.

    In your last capx the problem is with the "Trigger once" condition.

    After one gun has fired, event #5 is triggered, all good. Then a second gun fires, but the first gun still has Cycling=1, so this event will not be triggered, because it's still true and it has already triggered once.

    And then the first gun fires again, but event #5 is still true, so it's still not triggered and now both guns are stuck with Cycling=1.

    Here is a simple solution: