[r75] Possible bug in isOnScreen

Bugs will be moved here once resolved.

Post » Tue Jan 17, 2012 8:25 pm

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 ..
B
12
S
3
G
3
Posts: 73
Reputation: 2,647

Post » Wed Jan 18, 2012 8:01 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed Jan 18, 2012 8:47 pm

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.
B
12
S
3
G
3
Posts: 73
Reputation: 2,647

Post » Wed Jan 18, 2012 10:19 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Wed Jan 18, 2012 10:29 pm

Thanks Ashley
B
12
S
3
G
3
Posts: 73
Reputation: 2,647


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 0 guests