Coding help in NYC

I’m looking for a Codea mentor who can help me get through a simple game project. I’d love to do this in person with somebody who can show me the ropes. I’m thinking maybe one or two meetings in a coffee shop somewhere might do the trick. If it works out, I might be interested in additional help.

I’m in NYC - anybody out there interested? I’ll pay a fair wage :slight_smile:

I’m open to the idea of doing this remotely, using Google Hangouts or something, but we’d have to come up with a nice way to share code and screenshots.

… try Google

Here’s a simple example of a button class. There’s not much to make classes. Touch a button. As for class variables, use self.

function setup()
    b1=button(100,100,100,25)
    b2=button(200,200,100,50)
end

function draw()
    background(40, 40, 50)
    fill(255)
    b1:draw()
    b2:draw()
    if tch then
        text("button touched",WIDTH/2,HEIGHT/2)
    end
end

function touched(t)
    b1:touched(t)
    b2:touched(t)
end

button=class()

function button:init(x,y,w,h)
    self.xPos=x
    self.yPos=y
    self.width=w
    self.height=h
end

function button:draw()
    rect(self.xPos,self.yPos,self.width,self.height)
end

function button:touched(t)
    if t.state==BEGAN then
        if t.x>self.xPos and t.x<self.xPos+self.width and
                t.y>self.yPos and t.y<self.yPos+self.height then
            tch=true
        end
    end
    if t.state==ENDED then
        tch=false
    end
end

Have you tried using the meetup app/ website? Don’t know if it’s as big in the US, but in the UK it’s huge for organising code-related meet ups for all kinds of tech related stuff. I go to the mobile/ game-dev meetup in London. I demoed my Codea game Banjax there in January.

i’m in brooklyn. The best way to learn to use Codea is just look at the tutorials and add a bunch of print() statements everywhere to the example projects. If you’re not familiar with the Lua syntax, that’s a whole different problem that needs addressing.

@interactivenyc I guess the main question is: do you know anything about programming or do you just need help with Lua. If you know nothing about programming then you should get a book on how to program and read that. If you know nothing about Lua, then it’s just a simple matter of reading and following the tutorials.

Yes, I know a little about programming. It’s my day job :wink:

I’m a Flash/ActionScript programmer for Speakaboos, and I work on the mobile app.

I get frustrated when I have very specific questions, but can’t find a tutorial that solves my problem.

In this case it’s about how to use Classes properly, and what’s the best way to set up variables so that they’re Class variables and not Global variables.

Anybody know of a tutorial that explains that stuff?

Try here, there’s a tutorial on classes in there someplace.

https://coolcodea.wordpress.com/2013/03/10/starting-with-codea/

If you have a specific question, just ask. You’ll get plenty of answers.

@interactivenyc
Maybe you should have said something about the classes maybe Ignatz has a blog on that after all he does have nearly 300 blog post. I’m not sure on the url though I’ll check

Oh dave1707 already replied whoops! :smile:

I found the tutorial that helped the concepts click with me:

https://coolcodea.wordpress.com/2013/03/22/7-classes-in-codea/

At the bottom there’s a section called “what is this self thing” - that was the core cause of my confusion - whether you call a function with a dot or a colon.

Thanks for the button code too - that’s a nice simple example of a class implementation. One question though - you’ve got the button class in the same chunk of code as your Main code? Isn’t the button class supposed to be a separate file?

It doesn’t matter. Codea does that automatically to help keep your code organized, but you can put your class functions wherever you want

OK - I’m happy with my first joystick prototype!

Here’s the code. Curious to know what you think:

https://gist.github.com/interactivenyc/f8a98e9d2f5e1455e3eb38cc96fea179

I just exported this as an Xcode project, and it went very easily onto my phone - sweet! Are there options somewhere to disable the parameters/output panel, and the app play/pause/reset buttons at the bottom?

Nice job on your joystick. This is where you can start to learn more. You wrote the code and you kind of understand what’s happening. You can start to make changes to it to make it better and smaller. One issue you have is if you touch the screen with a second finger.

Look at displayMode in the reference for option on showing parameters etc

Next I’m going to divide the screen in two to support a left and a right controller. I suppose I should make it just a JoystickController class, and initialize it with a left or right parameter, to make it properly Object Oriented. I’m going to post this in Code Sharing, and continue development there.

Thanks all for your help and suggestions! I love Codea :slight_smile:

-Steve

There are stacks of joystick classes on the forum, if you want any ideas

Ah, the forums - look at all the code :slight_smile:

I hadn’t really looked there yet. Looks like lots of good stuff!

Thanks Ignatz.

It would be nice if Codea had a website for sharing code, similar to how Scratch works, where people could also rate the quality of people’s projects. The best stuff would float to the top, and be easier to find.

It looks like I can export a project as a zip file. I don’t suppose there’s an easy way to import those zip files? If that’s not possible, I’d like to add that as a Feature Request. Is there any official way to make feature requests here?

See the Issue Tracker link at the top of the forum for making suggestions or reporting problems.