Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6911767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:59:57+00:00 2026-05-27T08:59:57+00:00

I m working on a simple game where a ball tumbles on a slope

  • 0

I m working on a simple game where a ball tumbles on a slope and has to avoid the obstacles by jumping. The problem comes when I am trying to rotate the ball object using the Matrix. I am using the following code:-

private void rotateMe() {
    if(jump==0){
        Matrix mtx=new Matrix();
        mtx.postRotate(deg);
        Bitmap rotatedBMP=Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), mtx, false);
        deg=deg+1; //deg=0 in beginning
        bm=rotatedBMP;
    }   
}

This method is written in the class of ball, which is internally called by another method move(). The bitmap bm is not rotating as I wanted. It’s just falling out of the screen, which seems like the size of bitmap has increased. And I’ve to force close it after few seconds.
I’ve seen other rotate bitmap questions, but they are not working for me too.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:59:57+00:00Added an answer on May 27, 2026 at 8:59 am

    Anyways found the answer by myself. The code I am using now is as follows (for those who are having same problem)

    Matrix mtx=new Matrix();
    mtx.postRotate(deg,25,25);
    mtx.postTranslate(x, y);
    c.drawBitmap(bm, mtx, paint);
    deg=deg-10;
    

    The code is running fine now.
    Thanks anyways.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a simple 2D soccer game, while passing the ball between
I am working on a game in OBJ C that has a ball view
I'm trying to write a simple game working with two threads, one thread to
So I'm working on a simple iPhone game and am trying to make a
I'm working on an incredibly simple snake-game in C# using XNA. The problem is
I'm working on a simple board game in qt, and i have some problem
I'm working on a simple multiplayer game in which 2-4 players are placed at
I'm working on a simple 2D game engine in Java, and having no trouble
I'm working on a very simple game (essentially an ice sliding puzzle), for now
i am working on a simple web app which has a user model and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.