TextScroll: Week 4, June 27 – Michelle

The SKLabelNode I got tilting smoothly last Friday can’t handle large quantities of text, which is what I need for TextScroll. If I overload it, the label turns into a black bar, and this is a bug that hasn’t been fixed yet. I tried connecting a UILabel to the GameScene, but Stack Overflow advised that I keep UIKit stuff and GameScene stuff separate. Then I came across a suggestion to convert text to a bitmap image, then using that image as an SKSpriteNode. This would let me implement SpriteKit physics directly on the text (no need for the ball!), and works well with Adam’s data collection system. The person claimed that it wasn’t difficult to do, but the code they provided seemed to be a brief summary in Objective C that I couldn’t readily implement, so I tried finding other tutorials in Swift. There were complete code samples for adding text into larger images, but all I want is a function that takes some text and gives back a bitmap version of it in a narrow rectangle. I tried modifying the code online to do this, but no rectangle or text would appear when I tried running my code on the iPad. Prof. Medero suggested that I try coloring the rectangle in to see if it was the rectangle or the text that wasn’t getting drawn, but I was at a loss for how to do this on a CGRectangle. While I have experience with UIKit objects in the storyboard editor and SpriteKit objects, I didn’t realize that I had left Core Graphics unexplored, which was why I couldn’t make fully informed decisions about modifying the code I found. I am currently following a tutorial on Core Graphics to remedy that. It’s  teaching me a lot about how to make unique buttons and animations, so that’s exciting as well.

Once I succeed at this string to bitmap conversion, I hope that SpriteKit and Core Graphics will make implementing everything else much easier than if I had tried to modify the old Scrolling Label.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s