-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathThrowable.java
More file actions
32 lines (25 loc) · 1002 Bytes
/
Copy pathThrowable.java
File metadata and controls
32 lines (25 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.github.squidat;
import com.badlogic.gdx.graphics.g2d.Batch;
/**
* Created by Angel Camacho on 27/08/17.
*/
public class Throwable implements Behavior{
private static float angulo;
public void draw(Batch batch, float parentAlpha, Token token) {
if (angulo >= (2.0f * Math.PI)) {
angulo = 0.0f;
double x = 175f + (170f * Math.cos(2 * angulo));
double y = 250f + (170f * Math.sin(2 * angulo));
batch.draw(token.getGraphic(), (float) x, (float) y, token.getWidth(), token.getHeight());
token.setX((float) x);
token.setY((float) y);
} else {
angulo -= 0.0174533f;
double x = 175f + (170f * Math.cos(2 * angulo));
double y = 250f + (170f * Math.sin(2 * angulo));
batch.draw(token.getGraphic(), (float) x, (float) y, token.getWidth(), token.getHeight());
token.setX((float) x);
token.setY((float) y);
}
}
}