-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbala.java
More file actions
42 lines (31 loc) · 874 Bytes
/
bala.java
File metadata and controls
42 lines (31 loc) · 874 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
33
34
35
36
37
38
39
40
41
42
package src.aplicacion;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
public class bala {
private double speed = 2.0d;
private BufferedImage pSprite;
private int Width ,Height ;
private double xPos , yPos;
public bala(double xPos, double yPos){;
this.Width = 10;
this.Height= 10;
this.xPos = xPos;
this.yPos = yPos;
}
public void draw(Graphics2D g) {
URL url = this.getClass().getResource("misil.gif");
try {
pSprite = ImageIO.read(url);
g.drawImage(pSprite, (int)xPos, (int)yPos, Width, Height, null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void update(double delta, Player player) {
yPos= yPos + (delta * speed);
}
}