26 days before Horse Crazy has to be submitted to Apple and the project has an artist. Dwayne Ferguson (http://www.diehardstudio.com/) and I have traded art and programming in the past, but this project will be our first “joint venture.”
It’s kind of a secret for now, but we actually talked about doing a big project together earlier this year and it looks like that will happen very soon after HC is done! Something way different from HC and even bigger in scope!
Today I just put together placeholder screens for the app using Director. I also created a routine called makeButton that handles putting buttons on the screen as well as listening for events. Now to make a button it’s this easy:
local backBtn = makeButton("images/btn-menu.png", 40, 25, backAction, nil, localGroup)
What’s neat is that I can pass in the location to a button image or just a string and it will work with either one. So if I don’t have an image for a Back button yet, I can do this:
local backBtn = makeButton("Back", 40, 25, backAction, nil, localGroup)
…and the routine will put up the word “Back” and treat it like a button. When I get the artwork, I just replace that string with the location of the button image.
Besides being “easy” it also makes my code much shorter — fewer lines of code make for fewer chances to make a mistake.
Here’s a quick video kind of explaining the deal: