Page 1 of 1

Question about item 1 and item 2 on accelerometer

Posted: Wed Apr 16, 2014 2:05 pm
by apprentice12
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 ?

Re: Question about item 1 and item 2 on accelerometer

Posted: Wed Apr 16, 2014 9:55 pm
by Simon
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

Re: Question about item 1 and item 2 on accelerometer

Posted: Thu Apr 17, 2014 9:21 am
by apprentice12
Thanks ! You are the best !