Back to project page BulletsForever.
The source code is released under:
GNU General Public License
If you think the Android project BulletsForever listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.bulletsforever.bullets; // w w w. j a va 2 s.c o m import android.graphics.Canvas; /** * This is the player! * This should be instantiated by GameMain's setupWorld() * Only a single instance should exist per GameMain instance */ public class DrawObjectBullet extends DrawObject { public boolean remove; public boolean boss, suicide; //private Paint bulletPaint; public DrawObjectBullet(DrawWorld dw, boolean boss, boolean suicide, float x, float y, float v, float a, float gx, float gy, float angle, float angle_v) { super(dw, x, y, v, a, gx, gy, angle, angle_v, 5f, 5f); this.remove = false; this.boss = boss; this.suicide = suicide; if(!boss) this.bitmap = dw.bl.getBitmap(R.drawable.bullet, hitboxHalfWidth, hitboxHalfHeight); else if(boss & !suicide) this.bitmap = dw.bl.getBitmap(R.drawable.bossbullet, hitboxHalfWidth, hitboxHalfHeight); else if(boss & suicide) this.bitmap = dw.bl.getBitmap(R.drawable.bossbulletsuicide, hitboxHalfWidth, hitboxHalfHeight); //bulletPaint = new Paint(); //bulletPaint.setColor(Color.WHITE); } @Override public void nextFrame() { super.nextFrame(); // If off-screen if (x < Settings.screenXMin || x > Settings.screenXMax || y < Settings.screenYMin || y > Settings.screenYMax ) { remove = true; } } @Override public void draw(Canvas canvas) { /* canvas.drawRect( x - hitboxHalfWidth, y - hitboxHalfHeight, x + hitboxHalfWidth, y + hitboxHalfHeight, bulletPaint ); */ canvas.drawBitmap(bitmap, x - hitboxHalfWidth, y - hitboxHalfHeight, null); } @Override public void onCollision(DrawObject object) { // TODO Auto-generated method stub } }