-
Notifications
You must be signed in to change notification settings - Fork 0
/
Enemy.java
47 lines (42 loc) · 1.19 KB
/
Enemy.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
/**
* Enemy - represents the properties of a enemy object in the game
* @author Rupin Mittal
* @version May 28, 2019
*/
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
public class Enemy extends Movable
{
//variables
private ImageView enemyImageView; //the imageview for the enemy
//the pic still variable is inherited from Movable
//constructor
/**
* Constructor for Enemy Objects
* @param pic Image of still enemy
*/
public Enemy(Image pic)
{
defaultImage = pic; //set the image for the enemy
enemyImageView = new ImageView(defaultImage); //create the imageview
enemyImageView.setRotate(0); //set initial rotation value
}
//methods
/**
* Method to update the animation of enemy, like rotate it.
*/
@Override
public void updateAnimation()
{
enemyImageView.setRotate(enemyImageView.getRotate() + 10); //increment the rotation
}
/**
* Method to return the ImageView of the enemy
* @return ImageView of the enemy
*/
@Override
public ImageView getImageView()
{
return enemyImageView;
}
}