If commands?

Hello Everyone,

I am new to the forum :slight_smile:

Coding on iPad 2 is cool :smiley:

I got question, I made bat and I move the bat using current touch but when come if commands

I try stop the bat going off the screen

If CurrentTouch.X<10 then CurrentTouch.x=10 end

But I got error :frowning: and could anyone correct for me please as I did love make breakout clone :slight_smile:

Well looking at it, you have two separate variables… CurrentTouch.X and CurrentTouch.x are two different things. For all Vec2,3 and 4 the object’s vairables are all lowercase (x,y,z,a).

I am also not sure about trying to set CurrentTouch.x. If I remember correctly, that can change a ton based on where you finger hits the screen. When it comes to drawing things or handling touches… I use another variable like pos=vec2(x,y) and handle it like this.

function touched(touch)

if touch.x < somenum then


but thats just how I do things. I don’t use the CurrentTouch too much.

Hope this helps.

Can you show us your code. :smiley: