Hi guys
Happy new year :)
I started the year whit a little problem, and I'll be glad if someone
help me tnks !
So, I am trying to "spawn" a specific .bmp in my Android screen at the
initialization of the program, but the metod .getHeight() arent
created yet when I create my bitmap!
What I am doing:
public class GameView extends SurfaceView {
public GameView(Context context) {
blablabla surface created{ gameLoopThread.start(); }, destroyed,
changed
sprites = new SpriteCreation(this); //here I make ALL the sprites o/
( I think its the best way to optimize my program )
}
and the constructor of the class sprites:
public SpriteGood(GameView gameView, Bitmap bmp) {
this.gameView=gameView;
this.bmp=bmp;
rnd = new Random(System.currentTimeMillis());
this.width = bmp.getWidth() / BMP_COLUMNS;
this.height = bmp.getHeight() / BMP_ROWS;
xSpeed = rnd.nextInt(10) - 5;
ySpeed = rnd.nextInt(10) - 5;
x=0;
y=gameView.getHeight(); //THIS DOESNT WORK!!!!! the function
returns 0 -.- I think its because the system didnt create it yet when
I call...
}
I want the value of "y" be 2/3 the height of the screen! :(
I am afraid to put a random value, like 500, and in some phones the
screen height be less than that !
Someone help me ? If you guys didnt understand anything, you should
make questions... I dont know if I was clear enough..
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en