Question about item 1 and item 2 on accelerometer

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
apprentice12
Posts: 8
Joined: Fri Mar 28, 2014 2:47 pm

Question about item 1 and item 2 on accelerometer

Post by apprentice12 » Wed Apr 16, 2014 2:05 pm

Hi all.
So i was watching the video lesson on how to use the accelerometer.
I can't understand what the item 1 and item 2 of the Loc is.

add (pX * kSensitivity) to item 1 of theLoc
subtract (pY * kSensitivity) from item 2 of theLoc

if item 1 of theLoc < 0 then put 0 into item 1 of theLoc
if item 1 of theLoc > the width of this card then put the width of this card into item 1 of theLoc

put max(0, item 2 of theLoc) into item 2 of theLoc
put min(item 2 of theLoc, the height of this card) into item 2 of theLoc


Is it the pX and Py or something else ?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Question about item 1 and item 2 on accelerometer

Post by Simon » Wed Apr 16, 2014 9:55 pm

Hi apprentice12,
I can't understand what the item 1 and item 2 of the Loc is.
Please look up "location" in the dictionary. item 1 is distance from the left , item 2 is distance from the top of your card.
Is it the pX and Py or something else ?
It is the px and py.

Put this in your card script

Code: Select all

on mouseMove
put the mouseLoc
end mouseMove
You will see the Loc of the mouse, two numbers, it's x and y location.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

apprentice12
Posts: 8
Joined: Fri Mar 28, 2014 2:47 pm

Re: Question about item 1 and item 2 on accelerometer

Post by apprentice12 » Thu Apr 17, 2014 9:21 am

Thanks ! You are the best !

Post Reply