Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main.Entity.particle;
- import java.util.ArrayList;
- import java.util.List;
- import main.Screen;
- import main.Sprite;
- import main.Entity.Entity;
- public class Particle extends Entity {
- public static Sprite sprite;
- private int life;
- private int time = 0;
- protected double xx, xa, yy, ya;
- public Particle(int x, int y, int life) {
- this.x = x;
- this.y = y;
- this.xx = x;
- this.yy = y;
- this.life = life + (random.nextInt(50) - 25);
- sprite = Sprite.particle_normal;
- this.xa = random.nextGaussian();
- this.ya = random.nextGaussian();
- }
- public void update() {
- time++;
- if (time >= 7400) time = 0;
- if (time > life) remove();
- this.xx += xa;
- this.yy += ya;
- }
- public void render(Screen screen) {
- screen.renderSprite((int) xx, (int) yy, sprite, true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement