Scrolling BG missing after coming back from being suspended (iOS-SpriteKit-iphone)

8bit

I have an issue with my scrolling Background (WAVE) for a game I'm developing in Objective C Sprite Kit framework. I'm using a method from the book 'iOS Games by tutorials' (highly recommended- very informative book) as a guideline, as I'm new to it.

I got everything to work fine, but after I close the game.. and my iPhone been sitting for right around 20-30 minutes - I come back to the game and the Scrolling BG is blank for 5-15 seconds then it loads and scrolls. Oddly, when I first test the game - it loads immediately no issues. I also have nodes / graphics and they all load quickly each and every time no issues.

다음은 매 프레임 업데이트되는 주요 코드 스 니펫입니다.

- (void)moveWave
{

    CGPoint waveVelocity = CGPointMake(-wave_speed, 0);
    CGPoint amtToMove = CGPointMultiplyScalar(waveVelocity, _dt);
    _waveLayer.position = CGPointAdd(_waveLayer.position, amtToMove);

    [_waveLayer enumerateChildNodesWithName:@"wave"
                               usingBlock:^(SKNode *node, BOOL *stop){
                                   SKSpriteNode * wave = (SKSpriteNode *) node;
                                   CGPoint waveScreenPos = [_waveLayer convertPoint:wave.position
                                                                         toNode:self];
                                   if (waveScreenPos.x <= -wave.size.width) {
                                       wave.position = CGPointMake(wave.position.x+wave.size.width*2,
                                                                 wave.position.y);
                                   }
                               }];

}

20 분 동안 유휴 상태 인 iPhone으로 돌아온 이유에 대한 도움이나 통찰력은 게임을 다시로드합니다. 스크롤링 BG 만 누락되었지만 5-15 초 후에 시작되고 정상적으로 보입니다. 다시 말하지만, 처음로드하거나 5 분 동안 종료 한 다음 게임으로 돌아갑니다. 모든 것이 작동하고 즉시로드됩니다.

편집-스크롤하지 않고 BG 이미지를로드하려고 시도했기 때문에 스크롤 기능 / 방법이라는 것을 알고 있으며 20 분 이상 게임을 종료하고 돌아온 후에도 정상적으로로드됩니다. 흠 .. 스크롤링 BG가로드되지 않은 상태에서도 게임을 할 수 있습니다. 스크롤링 BG는 항상 결국로드됩니다 (보통 5-10 초 후에).

8 비트

확실히 델타 시간입니다.

음, 최고의 임시 / 해결 방법을 찾았습니다.

_dt를 제한하고 있습니다.

if (_dt > 1) {
        _dt = currentTime - _lastUpdateTime;

    }

_dt가 실제 시나리오에서 1 이상이되어서는 안되기 때문에 이것은 내 목적을 위해 훌륭하게 작동했습니다. 게임이 종료되고 다시 시작될 때 값을 저장하는 더 심층적 인 접근 방식이 있습니다.하지만 이것은 가장 간단한 imo입니다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Is it possible to stop output from a command after bg?

분류에서Dev

Swift Spritekit Scrolling Background

분류에서Dev

force Portrait mode after being in Landscape mode and tapping back

분류에서Dev

Layout only shows children after screen turn off or leaving the app and coming back

분류에서Dev

listbox highlights the selecteditem even after coming back in mvvm windows phone app

분류에서Dev

Preventing a UIWebView from scrolling after tapping a link

분류에서Dev

Prevent a UIPopover from being presented as UIPageSheet on iPhone 6 plus in landscape

분류에서Dev

Grails formRemote disabled field content isn't coming back as a param from GSP

분류에서Dev

iOS 7 : SpriteKit GestureRecognizer

분류에서Dev

how to convert a selected image from iphone library to pdf in ios sdk

분류에서Dev

How to fix missing characters from font after awakening from suspend?

분류에서Dev

UIPageViewController automatic scrolling in iOS

분류에서Dev

Fix a div after scrolling

분류에서Dev

Go back to ubuntu packages after installing from an external repository?

분류에서Dev

Go back to ubuntu packages after installing from an external repository?

분류에서Dev

Extra newline coming from somewhere

분류에서Dev

Where is the extra newline coming from?

분류에서Dev

iOS Endless Runner Lag SpriteKit

분류에서Dev

Low FPS on iOS Simulator SpriteKit

분류에서Dev

IOS Back to main page

분류에서Dev

How to Identify a Request is coming from same machine?

분류에서Dev

PHP change item in array coming from a database

분류에서Dev

Noise coming from HDD or CPU in headphones

분류에서Dev

css styling issue when coming from javascript

분류에서Dev

Where is this variable coming from in this Apache Camel program?

분류에서Dev

TouchedEnded over TouchesBegan-Swift iOS SpriteKit

분류에서Dev

Prevent packages from being removed after doing `dpkg --set-selections`

분류에서Dev

Network adapter missing in Ubuntu 18.04 after migration from VirtualBox to Hyper-V

분류에서Dev

how to prevent TouchEvent from scrolling

Related 관련 기사

  1. 1

    Is it possible to stop output from a command after bg?

  2. 2

    Swift Spritekit Scrolling Background

  3. 3

    force Portrait mode after being in Landscape mode and tapping back

  4. 4

    Layout only shows children after screen turn off or leaving the app and coming back

  5. 5

    listbox highlights the selecteditem even after coming back in mvvm windows phone app

  6. 6

    Preventing a UIWebView from scrolling after tapping a link

  7. 7

    Prevent a UIPopover from being presented as UIPageSheet on iPhone 6 plus in landscape

  8. 8

    Grails formRemote disabled field content isn't coming back as a param from GSP

  9. 9

    iOS 7 : SpriteKit GestureRecognizer

  10. 10

    how to convert a selected image from iphone library to pdf in ios sdk

  11. 11

    How to fix missing characters from font after awakening from suspend?

  12. 12

    UIPageViewController automatic scrolling in iOS

  13. 13

    Fix a div after scrolling

  14. 14

    Go back to ubuntu packages after installing from an external repository?

  15. 15

    Go back to ubuntu packages after installing from an external repository?

  16. 16

    Extra newline coming from somewhere

  17. 17

    Where is the extra newline coming from?

  18. 18

    iOS Endless Runner Lag SpriteKit

  19. 19

    Low FPS on iOS Simulator SpriteKit

  20. 20

    IOS Back to main page

  21. 21

    How to Identify a Request is coming from same machine?

  22. 22

    PHP change item in array coming from a database

  23. 23

    Noise coming from HDD or CPU in headphones

  24. 24

    css styling issue when coming from javascript

  25. 25

    Where is this variable coming from in this Apache Camel program?

  26. 26

    TouchedEnded over TouchesBegan-Swift iOS SpriteKit

  27. 27

    Prevent packages from being removed after doing `dpkg --set-selections`

  28. 28

    Network adapter missing in Ubuntu 18.04 after migration from VirtualBox to Hyper-V

  29. 29

    how to prevent TouchEvent from scrolling

뜨겁다태그

보관