summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/com/ilotterytea/maxoning/ui/LeafParticle.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/core/src/com/ilotterytea/maxoning/ui/LeafParticle.java b/core/src/com/ilotterytea/maxoning/ui/LeafParticle.java
new file mode 100644
index 0000000..24df879
--- /dev/null
+++ b/core/src/com/ilotterytea/maxoning/ui/LeafParticle.java
@@ -0,0 +1,30 @@
+package com.ilotterytea.maxoning.ui;
+
+import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.graphics.g2d.Batch;
+import com.badlogic.gdx.graphics.g2d.Sprite;
+import com.badlogic.gdx.graphics.g2d.TextureRegion;
+
+public class LeafParticle extends Sprite {
+ private float angle, x, y, vertAngle, rotation, time;
+
+ public LeafParticle(TextureRegion region, float x, float y, float angle, float vertAngle, float rotation) {
+ super(region);
+ this.angle = angle;
+ this.vertAngle = vertAngle;
+ this.rotation = rotation;
+ this.x = x;
+ this.y = y;
+ }
+
+ @Override
+ public void draw(Batch batch) {
+ this.time = Gdx.graphics.getDeltaTime();
+ this.x -= (float) Math.sin(time) * this.angle;
+ this.y -= (float) Math.sin(time) * this.vertAngle;
+
+ super.setPosition(x, y);
+ super.setRotation(super.getRotation() + this.rotation);
+ super.draw(batch);
+ }
+}