-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDancer.java
72 lines (60 loc) · 2.46 KB
/
Dancer.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
package org.academniadecodigo.dancedance.gameobjects;
import org.academiadecodigo.simplegraphics.pictures.Picture;
import org.academniadecodigo.dancedance.GenRandomNumber;
import org.academniadecodigo.dancedance.keyboard.KeysType;
import org.academniadecodigo.dancedance.simplegfx.StageSgfx;
import java.util.Random;
/**
* Created by codecadet on 20/10/16.
*/
public class Dancer {
private Picture idle;
private String[] upMovements = new String[4];
private String[] downMovements = new String[4];
private String[] leftMovements = new String[4];
private String[] rightMovements = new String[4];
private String[] wrongMovements = new String[4];
public void loadDancerPictures() {
idle = new Picture(StageSgfx.PADDING, StageSgfx.PADDING, "resources/art/3D Character Movements/STATIC_MOVEMENTS/3D_STATIC_IDLE_0.png");
for (int i = 0; i < 4; i++) {
upMovements[i] = "resources/art/3D Character Movements/STATIC_MOVEMENTS/3D_STATIC_UP_" + i + ".png";
downMovements[i] = "resources/art/3D Character Movements/STATIC_MOVEMENTS/3D_STATIC_DOWN_" + i + ".png";
leftMovements[i] = "resources/art/3D Character Movements/STATIC_MOVEMENTS/3D_STATIC_LEFT_" + i + ".png";
rightMovements[i] = "resources/art/3D Character Movements/STATIC_MOVEMENTS/3D_STATIC_RIGHT_" + i + ".png";
wrongMovements[i] = "resources/art/3D Character Movements/STATIC_MOVEMENTS/3D_STATIC_WRONG_" + i + ".png";
}
idle.draw();
}
public void hideDancer(){
idle.delete();
}
public Picture changeMovement(KeysType movement) {
int varToCompare;
int tempPicture = 0;
varToCompare = tempPicture;
tempPicture = GenRandomNumber.genRandom(0, 3);
if (varToCompare == tempPicture) {
tempPicture = GenRandomNumber.genRandom(0, 3);
}
switch (movement) {
case UP:
idle.load(upMovements[tempPicture]);
break;
case DOWN:
idle.load(downMovements[tempPicture]);
break;
case LEFT:
idle.load(leftMovements[tempPicture]);
break;
case RIGHT:
idle.load(rightMovements[tempPicture]);
break;
case SPACE:
idle.load(wrongMovements[tempPicture]);
break;
default:
return idle;
}
return idle;
}
}