-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSprite.java
More file actions
45 lines (40 loc) · 1.01 KB
/
Sprite.java
File metadata and controls
45 lines (40 loc) · 1.01 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
package ru.gb.jtwo.online.circles;
import java.awt.*;
public class Sprite {
protected float x;
protected float y;
protected float halfWidth;
protected float halfHeight;
protected float getLeft() {
return x - halfWidth;
}
protected void setLeft(float left) {
x = left + halfWidth;
}
protected float getRight() {
return x + halfWidth;
}
protected void setRight(float right) {
x = right - halfWidth;
}
protected float getTop() {
return y - halfHeight;
}
protected void setTop(float top) {
y = top + halfHeight;
}
protected float getBottom() {
return y + halfHeight;
}
protected void setBottom(float bottom) {
y = bottom - halfHeight;
}
protected float getWidth() {
return 2f * halfWidth;
}
protected float getHeight() {
return 2f * halfHeight;
}
void update(GameCanvas canvas, float deltaTime) {}
void render(GameCanvas canvas, Graphics g) {}
}