Back to project page linevslinerpg.
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.
package com.jmpmain.lvslrpg.particles; /*from www.j ava 2 s . c om*/ import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; public class Energy extends Particle { public long createTime; private Paint paint; private Rect particle; public Energy(int x, int y, long time){ destroy = false; createTime = time; particle = new Rect(x, y, x+8, y+8); paint = new Paint(); paint.setARGB(255, 0, 128, 150); } @Override public void update(long time) { if(time - createTime >= 1500){ destroy = true; return; } paint.setAlpha(Math.max(0, (int)(180.0f*(1 - (float)(time - createTime)/1500.0f)))); particle.top -= 1; particle.bottom -= 1; } @Override public void draw(Canvas canvas) { canvas.drawRect(particle, paint); } }