-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoin.java
76 lines (65 loc) · 1.2 KB
/
Coin.java
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* @(#)Coin.java
*
*
* @author
* @version 1.00 2018/6/1
*/
import java.awt.*;
import java.util.ArrayList;
import java.awt.event.*;
import javax.swing.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
public class Coin {
private int x, y, newY;
private double frame;
private boolean picked;
public Coin(int xx, int yy) {
x = xx;
y = yy;
newY = yy;
frame = 0;
picked = false;
}
public void addNewY(){
newY -= 2;
}
public void setPickedTrue(){//changes coin to picked
picked = true;
}
//frames for coin graphics
public void increaseFrame(){
if (frame > 9){
frame = 0;
}
else{
frame += 0.1;
}
}
public void speedFrame(){
if (frame > 9){
frame = 0;
}
else{
frame += 0.6;
}
}
public int getFrame(){
return (int) frame;
}
public boolean getPicked(){
return picked;
}
public int getNewY(){
return newY;
}
public int getX(){
return x;
}
public int getY(){
return y;
}
}