Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

New tutorial on the wiki: touches

edited November 2011 in General Posts: 2,161

Is a tutorial on working with touches. Also contains (in the "advanced" section) a silly little program that nonetheless keeps my kids occupied for hours.




  • edited November 2011 Posts: 273

    I posted this in another thread but it belongs here:

    @Andrew... working my way through the last bit of it now! What an excellent tutorial! -- and in my case, timely -- as I had a question earlier today involving touches to which Simeon posted a very useful bit of OO code in reply and your tutorial helps me understand it better.

    Would you be willing at some point to cast some light on (to me at least) inscrutable vectors (vec2) and classes?

  • Posts: 2,161

    Would you be willing at some point to cast some light on (to me at least) inscrutable vectors (vec2) and classes?

    I guess it would make sense to have tutorials on these. What, in particular, is so inscrutable about them?

  • edited November 2011 Posts: 273

    (What's inscrutable about them?) Their application.

    Your comments to your 'ball throwing' code are very helpful and the closest I've got to understanding the use of vectors.

    But what about if I wanted to add another ball to the mix? Or, similarly, instantiate another DragMe object with different attributes from the class that Simeon roughed out?

    (I spent a few hours this afternoon trying to do just this and ended up with the supreme kludge of using Simeon's code to make another class (DragMe2!) and creating an instance from it... this worked but is obviously not the point of creating a creating a class in the first place).

  • SimeonSimeon Admin Mod
    Posts: 5,718

    you should be able to do this with the DragMe example:

    -- Main
    function setup()
        box1 = DragMe()
        box2 = DragMe()
        box2.pos = vec2( WIDTH/2, HEIGHT/2 ) -- move box2 to middle of screen
    function draw()
    function touched(touch)
  • SimeonSimeon Admin Mod
    Posts: 5,718

    Also, Andrew that's an excellent tutorial. Thanks for writing it.

  • Posts: 273

    Simeon, again I thank you. I believe I'd figured most of it out apart from how to move the second box away from the first...

    box2.pos = vec2( WIDTH/2, HEIGHT/2 )


Sign In or Register to comment.