Skip to content

Commit 13c02ee

Browse files
committed
Merge branch 'alt'
2 parents 3223c13 + d4ee049 commit 13c02ee

File tree

6 files changed

+86
-13
lines changed

6 files changed

+86
-13
lines changed

src/com/redomar/game/Game.java

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public class Game extends Canvas implements Runnable {
4747
private static boolean changeLevel = false;
4848
private static boolean npc = false;
4949
private static int map = 0;
50+
private static int shirtCol;
51+
private static int faceCol;
52+
private static boolean[] alternateCols = new boolean[2];
5053

5154
private static JFrame frame;
5255

@@ -126,8 +129,20 @@ public void init() {
126129

127130
public void setMap(String Map_str) {
128131
setLevel(new LevelHandler(Map_str));
132+
if(alternateCols[0]){
133+
Game.setShirtCol(240);
134+
}
135+
if(!alternateCols[0]){
136+
Game.setShirtCol(111);
137+
}
138+
if(alternateCols[1]){
139+
Game.setFaceCol(310);
140+
}
141+
if(!alternateCols[1]){
142+
Game.setFaceCol(543);
143+
}
129144
setPlayer(new PlayerMP(getLevel(), 100, 100, input,
130-
getJdata_UserName(), null, -1));
145+
getJdata_UserName(), null, -1, shirtCol, faceCol));
131146
level.addEntity(player);
132147
}
133148

@@ -467,4 +482,36 @@ public static String getGameVersion() {
467482
return game_Version;
468483
}
469484

485+
public static int getShirtCol() {
486+
return shirtCol;
487+
}
488+
489+
public static void setShirtCol(int shirtCol) {
490+
Game.shirtCol = shirtCol;
491+
}
492+
493+
public static int getFaceCol() {
494+
return faceCol;
495+
}
496+
497+
public static void setFaceCol(int faceCol) {
498+
Game.faceCol = faceCol;
499+
}
500+
501+
public static boolean[] getAlternateCols() {
502+
return alternateCols;
503+
}
504+
505+
public static void setAlternateCols(boolean[] alternateCols) {
506+
Game.alternateCols = alternateCols;
507+
}
508+
509+
public static void setAternateColsR(boolean alternateCols){
510+
Game.alternateCols[1] = alternateCols;
511+
}
512+
513+
public static void setAternateColsS(boolean alternateCols){
514+
Game.alternateCols[0] = alternateCols;
515+
}
516+
470517
}

src/com/redomar/game/entities/Player.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class Player extends Mob {
1616
private static Name customeName = new Name();
1717
private Swim swim;
1818

19-
private int colour = Colours.get(-1, 111, 240, 310);
19+
private int colour, shirtCol, faceCol;
2020
private int tickCount = 0;
2121
private String userName;
2222
private boolean[] swimType;
@@ -25,10 +25,13 @@ public class Player extends Mob {
2525
public static String guestPlayerName = customeName.setName("Player ");
2626

2727
public Player(LevelHandler level, int x, int y, InputHandler input,
28-
String userName) {
28+
String userName, int shirtCol, int faceCol) {
2929
super(level, "Player", x, y, 1);
3030
this.input = input;
3131
this.userName = userName;
32+
this.faceCol = faceCol;
33+
this.shirtCol = shirtCol;
34+
this.colour = Colours.get(-1, 111, shirtCol, faceCol);
3235
}
3336

3437
public void tick() {
@@ -110,7 +113,7 @@ public void render(Screen screen) {
110113
int waterColour = 0;
111114
yOffset += 4;
112115

113-
colour = Colours.get(-1, 111, -1, 310);
116+
colour = Colours.get(-1, 111, -1, faceCol);
114117

115118
if (tickCount % 60 < 15) {
116119
waterColour = Colours.get(-1, -1, swimColour[0], -1);
@@ -141,7 +144,7 @@ public void render(Screen screen) {
141144
screen.render((xOffset + modifier - (modifier * flipBottom)),
142145
(yOffset + modifier), ((xTile + 1) + (yTile + 1) * 32),
143146
colour, flipBottom, scale);
144-
colour = Colours.get(-1, 111, 240, 310);
147+
colour = Colours.get(-1, 111, shirtCol, faceCol);
145148
;
146149
}
147150

src/com/redomar/game/entities/PlayerMP.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ public class PlayerMP extends Player {
1111
public int port;
1212

1313
public PlayerMP(LevelHandler level, int x, int y, InputHandler input,
14-
String userName, InetAddress ipAddress, int port) {
15-
super(level, x, y, input, userName);
14+
String userName, InetAddress ipAddress, int port, int shirtCol, int faceCol) {
15+
super(level, x, y, input, userName, shirtCol, faceCol);
1616
this.ipAddess = ipAddress;
1717
this.port = port;
1818
}
1919

2020
public PlayerMP(LevelHandler level, int x, int y, String userName,
21-
InetAddress ipAddress, int port) {
22-
super(level, x, y, null, userName);
21+
InetAddress ipAddress, int port, int shirtCol, int faceCol) {
22+
super(level, x, y, null, userName, shirtCol, faceCol);
2323
this.ipAddess = ipAddress;
2424
this.port = port;
2525
}

src/com/redomar/game/menu/Menu.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,34 @@ public static void play() {
194194
"Enter the name \nleave blank for local"));
195195
}
196196
Thread.sleep(125);
197-
splash.setProgress(95, "Aquring data: Username");
197+
splash.setProgress(94, "Aquring data: Username");
198198
Thread.sleep(125);
199-
splash.setProgress(96, "Initalizing as Server:Host");
199+
splash.setProgress(95, "Initalizing as Server:Host");
200200
Game.setJdata_UserName(JOptionPane.showInputDialog(Game.getGame(),
201201
"Enter a name"));
202+
Thread.sleep(250);
203+
splash.setProgress(96, "Collecting Player Data");
204+
Object[] options = { "African", "Caucasian"};
205+
int n = JOptionPane.showOptionDialog(frame,
206+
"Choose a race for the charater to be",
207+
"Choose a race", JOptionPane.YES_NO_OPTION,
208+
JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
209+
if(n == 0){
210+
Game.setAternateColsR(true);
211+
}else{
212+
Game.setAternateColsR(false);
213+
}
214+
Thread.sleep(250);
215+
Object[] options1 = { "Orange", "Black"};
216+
int n1 = JOptionPane.showOptionDialog(frame,
217+
"Which Colour do you want the shirt to be?",
218+
"Choose a shirt Colour", JOptionPane.YES_NO_OPTION,
219+
JOptionPane.QUESTION_MESSAGE, null, options1, options1[0]);
220+
if(n1 == 0){
221+
Game.setAternateColsS(true);
222+
}else{
223+
Game.setAternateColsS(false);
224+
}
202225
splash.setProgress(97, "Connecting as" + Game.getJdata_UserName());
203226
Thread.sleep(250);
204227
splash.splashOff();

src/com/redomar/game/net/GameClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private void handleLogin(Packet00Login packet, InetAddress address, int port) {
8181
print.print("[" + address.getHostAddress() + ":" + port + "] "
8282
+ packet.getUsername() + " has joined...", PrintTypes.NETWORK);
8383
PlayerMP player = new PlayerMP(Game.getLevel(), packet.getX(),
84-
packet.getY(), packet.getUsername(), address, port);
84+
packet.getY(), packet.getUsername(), address, port, Game.getShirtCol(), Game.getFaceCol());
8585
Game.getLevel().addEntity(player);
8686
}
8787

src/com/redomar/game/net/GameServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private void parsePacket(byte[] data, InetAddress address, int port) {
6969
+ "] " + ((Packet00Login) packet).getUsername()
7070
+ " has connected...", PrintTypes.SERVER);
7171
PlayerMP player = new PlayerMP(Game.getLevel(), 10, 10,
72-
((Packet00Login) packet).getUsername(), address, port);
72+
((Packet00Login) packet).getUsername(), address, port, Game.getShirtCol(), Game.getFaceCol());
7373
this.addConnection(player, (Packet00Login) packet);
7474
break;
7575
case DISCONNECT:

0 commit comments

Comments
 (0)