UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Opening Credits Crawl (Like Star Wars)

Forums > Swift

I want to present a narrative to my user when first entering my game. They have the option to skip and move on to game play, but would envision something like the opening scene to every Star Wars movie with text starting at the bottom, and moving away into infinity. For now, I'd be happy w/ something that will just automatically scroll up the screen until finished.

I've thought of using an SKLabelNode with a numberOfLines set to something way high, formatting my text w/ "\n" line breaks then doing a move action to slowly "crawl" it up the screen but wondering if anyone has a better solution to something like this.

Thanks...and loving the forum Paul...checking it multiple times a day.

2      

If SwiftUI is an option, you could try this:

How to Create Star Wars Animated Text Using SwiftUI

4      

You'd probably use a scroll view for that.

See if this link helps: https://stackoverflow.com/questions/2234875/programmatically-scroll-a-uiscrollview

3      

Ended up with this, which works great:

  • Create a multiline SKLabelNode with alpha set to 0.0
  • Add my text lines which are created by slicing up a single long String into an array of shorter Strings that are created dynamically based on screen width and font size
  • Placed the SKLabelNode just off the bottom of the screen
  • Run SKAction.sequence that does:
    • Drives movement up the screen
    • When it moves off the top of the scene, fade out and .removeFromParent()
  • If the user dosn't want to watch the entire scroll, after a short delay, a "button" (actionable custom BorderedLabelNode) is added to "Skip Narrative" and move on to the next behavior.

3      

Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.