JeZxLee Posted August 9, 2017 Share Posted August 9, 2017 Hi, I don't understand PixiJSv4's main loop and how it works: <script> function gameLoop() { FrameCount++; setTimeout(gameLoop, FrameRate); state(); renderer.render(stage); } <!-- "A 110% By Team www.16BitSoft.com!" --> </script> function play() { var CurrentTime = new Date().getTime(); if (CurrentTime > NextSecond) { FPS = FrameCount; FrameCount = 0; NextSecond = CurrentTime+1000; if (ScreenToDisplay == PlayingGameScreen && PAUSEgame == false && GameOver == 0) { if (SecondsLeft > 0) SecondsLeft--; else { PlayEffect(EffectMinuteBell); if (MinutesLeft > 0) { MinutesLeft--; SecondsLeft = 59; } else { PlayEffect(EffectGameOver); GameOver = 250; } } } } GetInput(); DisplayScreen(); ProcessButtons(); ProcessArrowSets(); FPSText = ""+FPS+"["+MouseX+","+MouseY+"]"; if (FPSmessage != null) TextSprites[FPSmessage].text = FPSText; CheckForBrowserResize(false); } How does "gameLoop" call "Play" ? Thanks! JeZxLee Quote Link to comment Share on other sites More sharing options...
xerver Posted August 9, 2017 Share Posted August 9, 2017 Well in the code you posted, it doesn't (unless state calls it, whatever that fn is). Also PixiJS doesn't have a loop, the loop only exists in user-land (or in PIXI.Application, but you aren't using that here). You can always put a breakpoint in `play` and look at the call stack. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.