0 Favourites

[r75] Possible bug in isOnScreen

  • I was going back & forth with kyatric and there might be a bug in isOnScreen. Capx has been PM'ed to Ashley.

    When starting the game notice that there are two grey planes criss-crossing, followed by two tan ones. Wait for the Game Over screen to show up and click its button. This resets all global variables and sends us back to the game layout. At this point there is an additional plane showing up at the beginning. When replacing the IsOnScreen function with a calculation based on current scroll value this problem can be worked around.

    It looks to me like isOnScren is using the value from the previous run when we switch layouts ..

  • I got your .capx, but can you reproduce it in a new project? It's far easier to debug. 'Is on screen' is one of the simplest conditions in Construct 2, and it itself just does a calculation based on the scroll position, so I'm not sure what could be wrong.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I have pretty much stripped the project down to its basics- this should be debuggable.

    The basic behavior is similar to what you've got in SpaceBlaster. Once an enemy spawn point becomes visible the enemy will start moving and it does just that the first time through. When leaving the layout and coming back to it later the code acts as though there was an additional spawn point on screen. Based on the location of that extra enemy my guess is that for the first tick isOnScreen is still using the scroll coordinates from the previous level, notices the spawn point near the end of the level and creates the enemy. Then in the next tick we are at the correct position and everything procedes as before.

  • Ah, I see. There was a quirk in the order layouts are initialised in. For the first tick it did indeed have the last time's view position. It should be fixed for next build.

  • Thanks Ashley <img src="smileys/smiley17.gif" border="0" align="middle" />

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