Many improvements
commited
commit
d038b4d88ac07f631f0a4808c41b5d0ab47b8742
... | ... | @@ -1,9 +1,9 @@ |
1 |
Lots of games involve tapping tiny objects on screen. But phones are small, fingers are fat, and people's patience is limited. So many games are *more fun* if they're *kind* to the player. If they hastily tapped in the general vicinity, but missed by a pixel? Give them a break and pretend they hit perfectly! |
|
1 |
So many games involve tapping very small objects on the screen. But phones are small, fingers are big, and people's patience is limited. So many games are *so much **fun*** if they're *kind* to the player. If they hastily tapped in the general vicinity, but missed by a pixel? Give them a break and pretend they hit perfectly! |
|
2 | 2 | |
3 | 3 | Here's my favorite way to turn that kindness into script: |
4 | 4 | |
5 | 5 | [[/uploads/pick_closest.png]] |
6 | 6 | |
7 | First, the three tappable Wood blocks add themselves to a list `$Bs`. (Short for BlockS!) Then the [[Touch Sensor]] feeds into [[Line vs Plane]] to compute the world coordinate the player tapped. The [[Loop]] then checks the distance to *all* blocks, and keeps track of the *best* pick. Finally, do whatever you wanted to do with the tapped object, e.g. [[Set Position]] moves it to the tap position. |
|
7 | First, the three tappable wood blocks add themselves to a list named `$Bs`. (Short for BlockS.) Then our [[Touch Sensor]] feeds into [[Line vs Plane]] to compute the world coordinate the player tapped. Our [[loop]] then checks the distance between our finger and the position of *all* blocks in the list, and keeps track of the *best* pick. Finally, do whatever you want with the tapped object, e.g. [[Set Position]] moves it to the tap position. |
|
8 | 8 | |
9 | 9 | In this example `Best` is initialized to `3`, so even if the tap misses by a large margin, it'll still count as a hit! And if multiple objects are within that distance, it'll still pick the *best* hit. |
... | ... | \ No newline at end of file |