Made input recognition more accurate.
Adjusted light rising punch movement.
This commit is contained in:
parent
6863b399da
commit
5a32d5d1fb
@ -106,7 +106,7 @@ public class BlueSpecials {
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(3.0,3.0,phb,ahb,pthb,athb,pushB,
|
||||
Frame f = new Frame(8.0,5.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(714,0,102,120);
|
||||
@ -139,7 +139,7 @@ public class BlueSpecials {
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(3.0,0.0,phb,ahb,pthb,athb,pushB,
|
||||
Frame f = new Frame(8.0,0.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(714,0,102,120);
|
||||
@ -172,7 +172,7 @@ public class BlueSpecials {
|
||||
/*
|
||||
frame creation
|
||||
*/
|
||||
Frame f = new Frame(-3.0,0.0,phb,ahb,pthb,athb,pushB,
|
||||
Frame f = new Frame(-8.0,0.0,phb,ahb,pthb,athb,pushB,
|
||||
//cancels (in order : normal, special, jump, move, dash)
|
||||
false,false,false,false,false);
|
||||
f.setSpriteWrap(714,0,102,120);
|
||||
|
@ -118,7 +118,7 @@ public class InputBuffer {
|
||||
else {frameToCheck = startFrameCount - backCounter;}
|
||||
boolean search = true;
|
||||
while(ret && search) {
|
||||
if(this.inputList[frameToCheck].containsButtonTab(command[i])) {
|
||||
if(this.inputList[frameToCheck].containsButtonTab2(command[i])) {
|
||||
ret = true;
|
||||
search = false;
|
||||
} else {
|
||||
|
@ -2,6 +2,9 @@ package gameplay.input;
|
||||
|
||||
import engine.input.GamepadInput;
|
||||
import engine.input.InputConst;
|
||||
import gameplay.input.ButtonIG;
|
||||
|
||||
import static gameplay.input.ButtonIG.*;
|
||||
|
||||
/**
|
||||
* The class handling the parsing of one input.
|
||||
@ -61,15 +64,40 @@ public class Inputs {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a number of inputs are contained simultaneously, in the form of an array of Buttons.
|
||||
* Contrary to the other containsButtonTab, will check that only these specified buttons are pressed.
|
||||
* @param bs a number of inputs. Check if those are contained in this
|
||||
* @return true if all inputs of in are also in this
|
||||
*/
|
||||
public boolean containsButtonTab2(ButtonIG[] bs) {
|
||||
ButtonIG[] directions = {DOWN,FORWARD,UP,BACK};
|
||||
ButtonIG[] buttons = {A,B,C,D};
|
||||
for(ButtonIG d : directions) {
|
||||
if(!this.containsInput(d) && buttonTabContainsButton(bs, d)) { return false;}
|
||||
if(this.containsInput(d) && !buttonTabContainsButton(bs, d)) { return false;}
|
||||
}
|
||||
for(ButtonIG d : buttons) {
|
||||
if(!this.containsInput(d) && buttonTabContainsButton(bs, d)) { return false;}
|
||||
if(this.containsInput(d) && !buttonTabContainsButton(bs, d)) { return false;}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean buttonTabContainsButton(ButtonIG[] bs, ButtonIG b) {
|
||||
for (int i = 0; i < bs.length; i++) { if(bs[i] == b) return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean[] getInputs() {
|
||||
return this.tab;
|
||||
}
|
||||
|
||||
public void recordFromGamepad(GamepadInput pad, boolean facesRight) {
|
||||
this.tab[ButtonIG.UP.toInt()] = pad.checkPressed(InputConst.up);
|
||||
this.tab[ButtonIG.DOWN.toInt()] = pad.checkPressed(InputConst.down);
|
||||
this.tab[DOWN.toInt()] = pad.checkPressed(InputConst.down);
|
||||
this.tab[ButtonIG.BACK.toInt()] = (pad.checkPressed(InputConst.left) && facesRight) || (pad.checkPressed(InputConst.right)&&!facesRight);
|
||||
this.tab[ButtonIG.FORWARD.toInt()] = (pad.checkPressed(InputConst.right) && facesRight) || (pad.checkPressed(InputConst.left) && !facesRight);
|
||||
this.tab[FORWARD.toInt()] = (pad.checkPressed(InputConst.right) && facesRight) || (pad.checkPressed(InputConst.left) && !facesRight);
|
||||
this.tab[ButtonIG.A.toInt()] = pad.checkPressed(InputConst.buttonX);
|
||||
this.tab[ButtonIG.B.toInt()] = pad.checkPressed(InputConst.buttonA);
|
||||
this.tab[ButtonIG.C.toInt()] = pad.checkPressed(InputConst.buttonY);
|
||||
|
Loading…
x
Reference in New Issue
Block a user