Archive by Author

How to play Pair_Up/Penguin_Links

General Rule:
The goal of this game is to eliminate all image tiles from the board by pairing up all the identical tiles. A connecting path will be drawn between the paring tiles. Here’s some simple rules about the path:

A path can can only go through the empty spaces
A path can have at most 2 turning points
A path can only go horizontally or vertically, not diagonally.

Here’s few examples of valid path:
Scoring:
You will score as you play, which is based on the time and lengths of the connecting paths: the faster you play, the more points you get; the longer the path is, the higher the score is.
Other Help:
While playing, you can get hint, shuffle the tiles, or pause the game. Just click the menu at any time to get more help. Shuffling can also to done by shaking the phone (you’ll feel the phone vibrated once shuffle is done).
You can pick …

Make Your Android Phone Vibrate

So I got this good suggestion from one user’s comment: when shake to shuffle, make the phone vibrate.
It’s actually a very simple 2-step operation, but android developer site wasn’t very clear about. Here’s how I did it:

Add permission in AndroidManifest.xml file like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.VIBRATE" />
……
</manifest>

In your program when you want the phone to vibrate:

// vibration lasts 300 milliseconds
((Vibrator)getSystemService(VIBRATOR_SERVICE)).vibrate(300);

Done!

How to detect shake motion on Android phone

When I was implementing the shake-to-shuffle feature in Pair-Up game, I googled for a similar code-snippet but didn’t have much luck. Eventually I came across this hidden code in Android Developer Guide which talks about using the phone motion sensor to program:
http://developer.android.com/guide/samples/ApiDemos/src/com/example/android/apis/os/Sensors.html
Alas! It can be done! But I just need a very simple function to detect if there’s a shake action. So my actual code is a lot simpler:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

// Need to implement SensorListener
public class ShakeActivity extends Activity implements SensorListener {
// For shake motion detection.
private SensorManager sensorMgr;
private long lastUpdate = -1;
private float x, y, z;
private float last_x, last_y, last_z;
private static final int SHAKE_THRESHOLD = 800;
 
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
…… // other initializations
// start motion …

A Bug Found by Fast Fingers

OK, so there IS a bug in this game.
Comment posted by Tony this morning:
Fun, managed to end up with two tiles that didn’t match though….
The moment I read this, I immediately know what went wrong: he’s typing too fast! (well, not his fault though). Here’s more details: when you tapped on two identical tiles, the system spent 0.3 seconds drawing a connecting path between them. Now if you have a fast finger, you can break it within that 0.3 seconds.
The bullet-proof solution to this would be freezing the board while drawing the path. But this introduced some computation overhead. Instead, I simply reduce the drawing time from 0.3 second to 0.01, and still able to see the flash of a connecting line on screen. Bingo! The bug fix was launched!

Pair Up Screenshot

Here’s a screenshot of this game on my G1:
This is from the second level of this game. There are totally 3 levels:

Elementary: 6×4 tiles
High School: 8×5
College: 9×7

Also here’s a great site to check this apps comments:
http://www.cyrket.com/package/com.clingmarks.pairup

A Series of Upgrades

Things has been a bit hectic the past few days with the post-launch upgrades.
Pair Up v1.0 was launch 4 days ago, and I had 4 upgrades since then, which makes the current version 1.4 — a quite iterative launch. . I have to book-keeping the launches here or I will forgot what has been done when:

v1.0 (3/25/09): First launch. Got several comments saying the image tile is way too small.
v1.1 (3/26/09): Increased image tile size from 40×40 to 45×45. Well, seems that’s not big enough though, but I’m reluctant to compromise the number of tiles given the limited display size.
v1.2 (3/26/09): Moved hint/shuffle buttons to options menu. Heard user’s complain on these two small buttons. This alternative worked pretty well. Thanks!
v1.3 (3/27/09): Shake to shuffle! This is a long-planned feature, and my personal favorite one: makes the game much more fun compared to its PC alternative.
v1.4 (3/28/09): Increased game …

Pair Up Launched!

It was officially launched midnight Mar 25th, 2009. Hooray!
Within one minute of the launch there was comment left, a rather encouraging one! The next morning I woke up, it was already downloaded 100+ times with an average rating of 60% — not bad!
Most of the complains are about small tile size: not fat-finger-Americans friendly . I took immediate action of increasing the image tile size from 40×40 to 45×45, and the update was released before noon of Mar 26th. As of now (3pm), the number of downloads is more than 300. Someone left a comment saying looking forward to more updates — Great! I DO have a list of fun features to implement.
But now, most importantly, a detailed help page is very much needed. I read one comment saying that the time progress bar hinders — actually that was intended: if you had tiles eliminated, the time stopped for …