VIJAY007

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

107 Neutral

About VIJAY007

  • Rank
    Newbie
  1. Hi all am trying to draw bitmap and redraw it in updated coorinates.but it is only drawn once. what to do. Code for your reference. [b]MainActivity.java[/b] import android.os.Bundle; import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.app.Activity; import android.view.Display; import android.view.Menu; import android.view.View; import android.view.WindowManager; public class MainActivity extends Activity { private PowerManager mPowerManager; //private WindowManager mWindowManager; //private Display mDisplay; private WakeLock mWakeLock; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new BitmapView(this)); // Get an instance of the PowerManager mPowerManager = (PowerManager) getSystemService(POWER_SERVICE); // Create a bright wake lock mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass() .getName()); } @Override protected void onResume() { super.onResume(); /* * when the activity is resumed, we acquire a wake-lock so that the * screen stays on, since the user will likely not be fiddling with the * screen or buttons. */ // Start the simulation } @Override protected void onPause() { super.onPause(); /* * When the activity is paused, we make sure to stop the simulation, * release our sensor resources and wake locks */ // Stop the simulation // mSimulationView.stopSimulation(); // and release our wake-lock //mWakeLock.release(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } [b] BitmapView.java[/b] import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.view.View; class BitmapView extends View { int posx=10; int posy=10; Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.obstacle); public BitmapView(Context context) { super(context); } public void update() { if(posx>getWidth()) { posx=-17; } else { posx=+17; } } @Override public void onDraw(Canvas canvas) { //super.onDraw(canvas); canvas.drawBitmap(bmp, posx, posy, null); update(); invalidate(); } }
  2. Bitmap detection problem.

    yes Obstacle is not a object. will make it an object. thanks all for your valuable advice.
  3. Bitmap detection problem.

    Hi guys I have a bitmap named obstacle. i have drawn bitmap the bitmap in several places. psedo code. draw(obstacle,10,10,null);------------1 draw(obstacle,45,10,null);------------2 draw(obstacle,16,10,null);------------3 draw(obstacle,50,60,null);------------4 draw(obstacle,20,50,null);------------5 my problem is how to identify these 5 drawn objects indivually. eg:- for collision detection i have a character. if it collides with anyone it should die. i have like charcollides with obstacle then die. my prob is it die only when it collides with first obstacle since all obstacles names are same. what to do ??? one more thing how to get accurate values from accelometer ? Thanks in advance
  4. Android Game development

    GameGeazer Thanks a lot for the links.
  5. Android Game development

    Hi guys am new to android programming. am trying to create a game. Consider the flower bracket ({) as my screen. (||||) lines as a wall. {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{} { } { |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| } { | } { | } { ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| } { } { } {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{} how to detect collision if i touch wall assume i have ball moving on the screen. how to make a rectangular bound for bitmap? All ideas and advice are appreciated.