Avi Zana
Avi Zana

Reputation: 89

how to create a bubbles game UI in android

I want to create a bubbles like game in android and I'm not sure how to draw the graphics. Should I use canvas ? Every bubble should be a bitmap or maybe an image view ?

Another thing, I want to be able to rotate / scale the bubbles. I've tried with bitmaps and canvas but wasn't able to rotate the bubbles. Image view for every bubble looks like a mess to me.

Your help is appreciated.

Thanks

Upvotes: 0

Views: 890

Answers (1)

boztalay
boztalay

Reputation: 562

If you want to make a game, I would suggest using a Canvas, and put the Canvas over most, or all, of your layout. Creating anything but the most basic game using the regular UI structures would be a nightmare.

It sounds like you've gotten to the point where you can load the bubble images and draw them to the canvas, which is good. As for rotating the bubbles, use this:

Matrix rotator = new Matrix();
rotator.postRotate(90);
canvas.drawBitmap(bitmap, rotator, paint);

That was from an answer to this SO question, which was more specifically about rotating bitmaps on a Canvas.

For more information on making games in Android, this book was pretty helpful for me.

Hope that helps!

Upvotes: 2

Related Questions