-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLinkChange.java
More file actions
92 lines (83 loc) · 2.12 KB
/
LinkChange.java
File metadata and controls
92 lines (83 loc) · 2.12 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
/**
* @(#)GraphicalStuff.java
*
*
* @author
* @version 1.00 2012/3/19
*/
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class LinkChange implements Runnable{
public Link link;
public LinkChange(Link theLink) {
this.link = theLink;
}
//@Override
public void run (){
while (1>0){
if (!this.link.linkSlash){
if (this.link.direction.equals("u")){ //If Link is walking upwards...
if (this.link.image == this.link.linkPic[0]){ //If he has one icon for walking upwards...
this.link.image = this.link.linkPic[1]; //Switch to the other
}
else { //Repeat for all other directions and images
this.link.image = this.link.linkPic[0];
}
}
else if (this.link.direction.equals("d")){
if (this.link.image == this.link.linkPic[4]){
this.link.image = this.link.linkPic[5];
}
else {
this.link.image = this.link.linkPic[4];
}
}
else if (this.link.direction.equals("r")){
if (this.link.image == this.link.linkPic[2]){
this.link.image = this.link.linkPic[3];
}
else {
this.link.image = this.link.linkPic[2];
}
}
else if (this.link.direction.equals("l")){
if (this.link.image == this.link.linkPic[6]){
this.link.image = this.link.linkPic[7];
}
else {
this.link.image = this.link.linkPic[6];
}
}
try{
Thread.sleep(100); //Delay his next image change
}
catch (InterruptedException e){
}
}
else {
if (this.link.sDirection.equals("u")){ //If Link is walking upwards...
this.link.image = this.link.linkPic[8];
}
else if (this.link.sDirection.equals("d")){
this.link.image = this.link.linkPic[10];
}
else if (this.link.sDirection.equals("r")){
this.link.image = this.link.linkPic[9];
}
else if (this.link.sDirection.equals("l")){
this.link.image = this.link.linkPic[11];
}
try{
Thread.sleep(5); //Delay his next image change
}
catch (InterruptedException e){
}
}
//
}
}
public static void main(String args[]) {
//(new Thread(new mapRefresher())).start();
}
}