-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBlueMoblin.java
More file actions
94 lines (81 loc) · 2.02 KB
/
BlueMoblin.java
File metadata and controls
94 lines (81 loc) · 2.02 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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import java.awt.*;
import javax.swing.*;
import java.awt.image.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
import java.awt.event.*;
import java.util.*;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.imageio.ImageIO;
//import json.org.*;
public class BlueMoblin extends Monster{
// Global Variables
//public JLabel theLabel = new JLabel("SAGFAD");
public BlueMoblin(int theX, int theY, /*BufferedImage theScreenShot,*/ ZeldaPlayWindow theWindow, int theNum) {
super(theX, theY, theWindow, theNum);
for (int i = 0; i < 8; i++){
try{
this.monPic[i] = ImageIO.read(new File("Monster Sprites/Moblin/B" + i + ".gif")); //Saves each of Link's pictures for easy access
//this.linkPic[i].setOpaque(false);
}
catch (IOException e){
}
}
this.switchImage = true;
this.image = this.monPic[0];
this.straightWalking = 3;
this.speed = 11;
this.HP = 3;
this.strength = 2;
this.damaging = true;
this.shootRate = 1;
this.projectile = new Arrow(this);
(new Thread(this.projectile)).start();
}
public void run(){
this.appear();
(new Thread(new MonsterChange(this))).start();
while (1>0){
if (!this.hurt || !this.knockBack){
this.move();
this.checkChange();
this.linkHit();
this.monHit();
if (this.checkShoot()){
this.shoot();
}
try{
Thread.sleep(this.speed); //Delay his next image change
}
catch (InterruptedException e){
}
}
else {
this.monockback();
}
hurtCount++;
if (hurtCount == 69){
if (!this.knockBack){
this.hurt = false;
this.invincible = false;
this.flash = false;
}
else {
hurtCount = 0;
this.knockBack = false;
}
}
if (this.HP == 0){
this.die(); //Homestuck reference FTW!
break;
}
try{
Thread.sleep(1); //Delay his next image change
}
catch (InterruptedException e){
}
}
}
}