Although, disjoint else-if statements are actually faster in some programming languages. 
Yes, that's right, and that's why it's absolutely correct to use them.
| « previous next » |
July 24, 2010, 10:45:02 am
Posts: 46
Logged
Re: searching java code

July 24, 2010, 01:46:22 pm
Posts: 41
Logged
Re: searching java code
July 24, 2010, 03:27:15 pm
Posts: 41
Logged
Re: searching java code
public void targetExecutionCode() {
/** A.I. targeting execution code!!! */
/** join the if-s
if(Buffer.Player().ai == true && mode == Constant.selectYourTarget) {
if(animationIterator == animationDelay-1) {
contentPane.remove(screen);
*/
if((Buffer.Player().ai == true) && (mode == Constant.selectYourTarget)
&& (animationIterator == animationDelay-1)) {
contentPane.remove(screen);
/**
* a switch replacing the commented if-else structures
*/
switch(attackType) {
case Constant.normalAttack :
if (Buffer.Player().range > 2) {
attackType = Constant.rangedAttack;
}
battleAnimation = new MeleeSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
battleAnimation.setBounds(0,0,maxX,maxY);
/* TODO: Stop local animation loop? */
contentPane.add(battleAnimation);
break;
case Constant.rangedAttack :
rangedAnimation = new RangedSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
rangedAnimation.setBounds(0,0,maxX,maxY);
/* TODO: Stop local animation loop? */
contentPane.add(rangedAnimation);
break;
}// switch
} // combined if
} // end of targetExecutionCode()
/**
* Replaced if-else structure in targetExecutionCode()
*
* case constant.normalAttack
*
* if(Buffer.Player().range > 2 && attackType == Constant.normalAttack) {
attackType = Constant.rangedAttack;
}
if(attackType == Constant.normalAttack) {
battleAnimation = new MeleeSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
battleAnimation.setBounds(0,0,maxX,maxY);
TODO: Stop local animation loop?
contentPane.add(battleAnimation);
}
else if(attackType == Constant.rangedAttack) {
rangedAnimation = new RangedSequencePanel(Buffer.Player(),Buffer.getEnt(targets[0]));
rangedAnimation.setBounds(0,0,maxX,maxY);
TODO: Stop local animation loop?
contentPane.add(rangedAnimation);
}
a complicated way to call repaint()
this.paint(this.getGraphics());
mode = Constant.modeAttack;
changing the sound
JukeBox.PlayBattleTune(); */
July 24, 2010, 03:29:19 pm
Posts: 41
Logged
Re: searching java code
public static final int overlandWalking = 0;
public static final int standardMenuActive = 1;
public static final int selectYourTarget = 2;
public static final int modeAttack = 5;
public static final int statusCheck = 6;
public static final int endOfTurn = 7;
[/code}
etc...
July 24, 2010, 03:31:07 pm
Posts: 837
Logged
Re: searching java code
July 24, 2010, 03:32:27 pm
Posts: 41
Logged
Re: searching java code

July 24, 2010, 03:36:59 pm
Posts: 837
Logged
Re: searching java code
July 24, 2010, 04:53:48 pm
Posts: 1,208
Logged
Re: searching java code
.
July 24, 2010, 05:21:51 pm
Posts: 837
Logged
Re: searching java code
July 24, 2010, 09:39:28 pm
Posts: 41
Logged
Re: searching java code
private int up = 0;
private int down = 0;
private int left = 0;
private int right = 0;
/**equals 1 if particular button was once pressed and not released yet.*/
private int opup = 0;
private int opdown = 0;
private int opleft = 0;
private int opright = 0;
July 24, 2010, 10:31:11 pm
Posts: 41
Logged
Re: searching java code
July 25, 2010, 03:15:07 am
Posts: 1,129
Logged
Re: searching java code

July 25, 2010, 12:35:14 pm
Posts: 41
Logged
Re: searching java code

July 25, 2010, 09:18:57 pm
Posts: 41
Logged
Re: searching java code

