adding fallingpip

This commit is contained in:
James 2024-04-21 16:47:31 +01:00
parent 9b92852b77
commit 1953e95ba2

View file

@ -0,0 +1,34 @@
package com.monjaro.gamejam.main;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Vector2;
import java.util.Random;
public class FallingPip extends Actor {
private final Transform transform;
private final Vector2 velocity;
private final float rotationalVelocity;
public FallingPip(Transform transform) {
Random random = new Random();
this.transform = transform;
velocity = new Vector2(-1 + random.nextFloat() * 2, random.nextFloat() * 2);
rotationalVelocity = 40 * (-0.5f + random.nextFloat());
}
@Override
public void tick() {
transform.x += velocity.x;
transform.y += velocity.y;
transform.rotation += rotationalVelocity;
}
@Override
public void render(SpriteBatch batch) {
}
}