Episode nine of the Making Games With Ruby series, Game States (Title, About, and Pause), is finally written! This episode has us implementing game states, which lays the foundation for our Pause, Title, and About screens, which we also implement in this episode. You can read it here: http://devel.manwithcode.com/making-games-with-ruby.html#7
This one is probably the longest episode in the entire series (at least so far), which is why it’s taken me a bit longer to finish. (I’m still not 100% sure I’ve caught every mistake, so if you see any code errors or script typos, don’t hesitate to email me, or leave a comment here).
9 thoughts on “Making Games With Ruby – Episode 9 Written”
Hey, I just wanted to say I stumbled across your tutorials yesterday and they’re fantastic. These tutorials are great, essential to me even as I’m an aspiring indie dev whose taking his first steps in programming with Ruby.
Excelent! I’m glad you like the tutorials, and I’m happy that I could help! 🙂
Good luck with your indie adventures!
Hey Tyler. I’m really glad to see you’ve been making these tutorials. I just went through 1-8 and the only problems I ran into were ones I created myself by typing something in wrong.
But when I got to episode 9, something strange started happening. It has to do with the TTF text stuff. It was working just fine at the end of episode 8, when everything is just one file… but now that I’ve split the code into game, shared, and ingame, I keep getting this Rubygame::SDLError:
“Could not open font: Couldn’t open media/font.ttf”
I’m not really sure what I’ve done wrong. I liked my pong game… *sniff* Is there anything I should double-check? Would you need more information to be able to tell what’s happening?
Hmm… Ok, not sure what’s causing this issue, I have a few ideas though. It’ll be easier to work this out over email, so check there for something from me.
Hey, Tyler. I did some more tweaking and my problem with the font goes away when everything is in the same directory. I thought I was redirecting everything the right way, but maybe I wasn’t.
Anyway, I wanted to write again to report a little problem I found with lesson 9. After you show us how to move the selector in the title scene, you go on to show us how to make the selection do something when we press enter. (It’s where you say, “If we run it now, we can see our menu selector in action! Cool! Except, we can’t actually pick anything… Only move between choices, let’s fix that!:”) Right there, you have us make a change to the Selector.update method, but I’m fairly sure it’s supposed to be the Title.update method instead… Selector.update has all the fancy movement and speed stuff in it, while Title.update looked a lot like the example you gave.
Sorry if I’m wrong about it, though. It works for me when I changed Title.update instead of Selector.update, so I think that’s what you meant to write…
Yep, it’s true, it should’ve been Title#update, not Selector#update. Thanks for catching that! 🙂 I have it changed, and I’ll upload the changes right after I post this reply.
I don’t know if I did something wrong or what, but after about half an hour screwing around I can’t figure this out. Whenever I try and load the About screen the game crashes. All other functions work properly to my knowledge. And could you post the code in the tutorials so that it’s easier to copy/paste? When I get frustrated enough to just copy your files I always have to go and remove the line numbers.
Great work, btw.
EDIT: This is occuring just after I finish lesson 9.
The code *is* easy to copy and paste, it just may not be obvious how to do it. When you hover over a piece of source code, four buttons appear in the top right corner, the first one pops open a window with the code that doesn’t contain any line numbers nor syntax highlighting (it’s just plain text), you can do a “select all” on that and then copy the code. The second button directly copies the code to your clipboard (without the line numbers), but it gives me issues sometimes.
What operating system are you using? What version of Ruby? Did the About screen ever work? You are requiring ./lib/about.rb? Is ./lib/about.rb even implemented? I can’t really diagnose the problem from here, but if you could send me a zip file of your version of the game, that’d be great.
I am running Win7 and I never checked it before. Not sure about ruby itself but rubygame is version 2.6.2. I am accessing about properly, and it is implemented correctly to my knowledge. I am sending the .zip to you shortly.