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

  • Home
  • SEARCH
  • 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 9172365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:19:43+00:00 2026-06-17T16:19:43+00:00

I am new in AndEngine. I am using following code to display an image

  • 0

I am new in AndEngine. I am using following code to display an image of a ball.

private ITextureRegion mBallTextureRegion;
private Sprite ball1;

@Override
public void onCreateResources() {
   ITexture ball = new BitmapTexture(this.getTextureManager(),
             new IInputStreamOpener() {
                    @Override
                public InputStream open() throws IOException {
                return getAssets().open("gfx/ball.png");
                        }
            });
  this.mBallTextureRegion = TextureRegionFactory.extractFromTexture(ring1);

  ....................
  ....................
}


@Override
protected Scene onCreateScene() {
   final Scene scene = new Scene();
   scene.attachChild(backgroundSprite);
   ...........
   ball1 = new Sprite(192, 63, this.mBallTextureRegion, getVertexBufferObjectManager());
   scene.attachChild(ball1);
   ..............
   ...........  

}

Now, depending on the game level I want to add multiple ball of different size in the scene. Is it possible to add ITextureRegion mBallTextureRegion multiple time in different size(using different magnifying it)? If it is, then how? Please help me this sample code.

  • 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-06-17T16:19:45+00:00Added an answer on June 17, 2026 at 4:19 pm

    if you want to resize a Sprite,AnimatedSprite,Text,etc…

    //the original image x2, 2f because the parameter is float
    youSprite.setScale(2f);
    

    if you use a texture region in more sprites:

    Sprite youSprite; 
     //set deepCopy() in you texture to optimized memory
    youSprite= new Sprite(0,0,youTexture.deepCopy(),mEnginge.getVertexTextureManager());
    

    and if you want generate random position of each ball use “Random” variable.

    best regards.

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

Sidebar

Related Questions

In andngine , I defined a texture, using the following line code: private Texture
I am new to Android development and facing a problem while using AndEngine. I
I'm new to AndEngine and I want to draw a line by using my
I was following [JSP Insert Image][1] to insert image on Google Cloud Sql using
I want to develop a game using Andengine and i am new to game
I am new to Android Game Development, I am using Andengine for the Game
I'm using andengine in my Android application and would like to display images from
I have started using Andengine, and after following some tutorials I'm starting to develope
Im new to android dev and using andengine and ive just come across a
I'm building an android game powered by AndEngine game framework. I'm using the following

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.