Android Open Source - linevslinerpg Bomb






From Project

Back to project page linevslinerpg.

License

The source code is released under:

Apache License

If you think the Android project linevslinerpg listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.jmpmain.lvslrpg.particles;
//from w w w .  j a v  a2 s .  c  om
import com.jmpmain.lvslrpg.GameSurface;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

public class Bomb extends Particle {

  Paint paint;
  
  public float x;
  public float y;
  
  public float destX;
  public float destY;
  
  private long createTime;
  private long throwTime;
  
  public Bomb(float x, float y, float dx, float dy){
    this.x = x;
    this.y = y;
    
    destX = dx;
    destY = dy;
    
    destroy = false;
    
    paint = new Paint();
    paint.setColor(Color.WHITE);
    createTime = System.currentTimeMillis();
    
    throwTime = (long) (Math.abs((x - destX)) + Math.abs((y - destY)));
  }
  
  @Override
  public void update(long time) {
    if(time - createTime > throwTime){
      destroy = true;
    }
  }

  @Override
  public void draw(Canvas canvas) {
    canvas.drawBitmap(GameSurface.bomb,
      x + ((float)(destX - x))/((float)throwTime /((float)((System.currentTimeMillis() - createTime)))),
      y + ((float)(destY - y))/((float)throwTime /((float)((System.currentTimeMillis() - createTime)))), paint);
  }

}




Java Source Code List

com.jmpmain.lvslrpg.AudioPlayer.java
com.jmpmain.lvslrpg.GameSurface.java
com.jmpmain.lvslrpg.GameThread.java
com.jmpmain.lvslrpg.LineCanvas.java
com.jmpmain.lvslrpg.MainActivity.java
com.jmpmain.lvslrpg.MapGenerator.java
com.jmpmain.lvslrpg.Map.java
com.jmpmain.lvslrpg.OptionsAdapter.java
com.jmpmain.lvslrpg.entities.AILineEntity.java
com.jmpmain.lvslrpg.entities.Entity.java
com.jmpmain.lvslrpg.entities.Item.java
com.jmpmain.lvslrpg.entities.LineEntity.java
com.jmpmain.lvslrpg.entities.PlayerLineEntity.java
com.jmpmain.lvslrpg.particles.Blood.java
com.jmpmain.lvslrpg.particles.Bomb.java
com.jmpmain.lvslrpg.particles.Energy.java
com.jmpmain.lvslrpg.particles.Heal.java
com.jmpmain.lvslrpg.particles.ItemParticle.java
com.jmpmain.lvslrpg.particles.Particle.java
com.jmpmain.lvslrpg.particles.Smoke.java