ALLES
This commit is contained in:
+201
-62
@@ -14,7 +14,10 @@ public class Player2 extends Actor
|
||||
*/
|
||||
|
||||
public int leben;
|
||||
int maxLeben;
|
||||
long c;
|
||||
long d = 0;
|
||||
long e = 0;
|
||||
boolean schautNachRechts;
|
||||
long attackTimer = 0;
|
||||
int attackPhase = 0;
|
||||
@@ -23,10 +26,22 @@ public class Player2 extends Actor
|
||||
long laufTimer = 0;
|
||||
boolean laeuft = false;
|
||||
int charakter;
|
||||
boolean attacking2 = false;
|
||||
String attacke1Animation;
|
||||
String attacke2Animation1;
|
||||
String attacke2Animation2;
|
||||
String defaultAnimation;
|
||||
String walk1;
|
||||
String walk2;
|
||||
String walk3;
|
||||
String walk4;
|
||||
int attack2Duration;
|
||||
int speed;
|
||||
double speedFaktor;
|
||||
double speedFaktor2;
|
||||
|
||||
Player2(int pCharakter){
|
||||
charakter = pCharakter;
|
||||
leben = 100;
|
||||
schautNachRechts = false;
|
||||
charakter();
|
||||
}
|
||||
@@ -36,142 +51,221 @@ public class Player2 extends Actor
|
||||
gravitation();
|
||||
springen();
|
||||
animation1();
|
||||
anitmationLaufen();
|
||||
animationLaufen();
|
||||
}
|
||||
|
||||
public void bewegung(){
|
||||
if(Greenfoot.isKeyDown("right")){
|
||||
if(Greenfoot.isKeyDown("l")){
|
||||
setRotation(0);
|
||||
move(5);
|
||||
move(speed);
|
||||
if(!schautNachRechts && attackPhase == 0){
|
||||
getImage().mirrorHorizontally();
|
||||
schautNachRechts = true;
|
||||
}
|
||||
laeuft = true;
|
||||
attacke();
|
||||
attacke2();
|
||||
}
|
||||
if(Greenfoot.isKeyDown("left")){
|
||||
if(Greenfoot.isKeyDown("j")){
|
||||
setRotation(0);
|
||||
move(-5);
|
||||
move(-speed);
|
||||
if(schautNachRechts && attackPhase == 0){
|
||||
getImage().mirrorHorizontally();
|
||||
schautNachRechts = false;
|
||||
}
|
||||
laeuft = true;
|
||||
attacke();
|
||||
attacke2();
|
||||
}
|
||||
}
|
||||
|
||||
public void springen(){
|
||||
if(Greenfoot.isKeyDown("up") && this.getY() > 289 ){
|
||||
if(Greenfoot.isKeyDown("i") && this.getY() > 289 ){
|
||||
for(int i = 12; i > -12; i--){
|
||||
setRotation(270);
|
||||
move(i);
|
||||
setRotation(0);
|
||||
Greenfoot.delay(1);
|
||||
bewegung();
|
||||
attacke();
|
||||
attacke2();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attacke(){
|
||||
if(Greenfoot.isKeyDown(".")){
|
||||
if(System.currentTimeMillis() >= c){
|
||||
|
||||
if (!attacking) {
|
||||
if(System.currentTimeMillis() >= c){
|
||||
if(Greenfoot.isKeyDown("o")){
|
||||
if (!attacking && !attacking2) {
|
||||
attacking = true;
|
||||
attackPhase = 1;
|
||||
attackTimer = System.currentTimeMillis();
|
||||
|
||||
|
||||
if(schautNachRechts){
|
||||
setImage("1Combo2.png");
|
||||
setImage(attacke1Animation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
}
|
||||
else{
|
||||
setImage("1Combo2.png");
|
||||
setImage(attacke1Animation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
c = System.currentTimeMillis() + 500;
|
||||
return true;
|
||||
c = System.currentTimeMillis() + (int)(500/speedFaktor);
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
if(attacking && attackPhase == 1 && System.currentTimeMillis() >= d){
|
||||
d = System.currentTimeMillis() + (int)(300/speedFaktor);
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean attacke2(){
|
||||
if(System.currentTimeMillis() >= c){
|
||||
if(Greenfoot.isKeyDown("u")){
|
||||
if (!attacking2 && !attacking) {
|
||||
attacking2 = true;
|
||||
attackPhase = 1;
|
||||
attackTimer = System.currentTimeMillis();
|
||||
|
||||
if(schautNachRechts){
|
||||
setImage(attacke2Animation1);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
}
|
||||
else{
|
||||
setImage(attacke2Animation1);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
c = System.currentTimeMillis() + (int)(800/speedFaktor);
|
||||
}
|
||||
}
|
||||
if(attacking2 && attackPhase == attack2Duration && System.currentTimeMillis() >= System.currentTimeMillis()+e){
|
||||
e = (int)(1000/speedFaktor2);
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void animation1(){
|
||||
if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= 200) {
|
||||
if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= (int)(200/speedFaktor)) {
|
||||
if(schautNachRechts){
|
||||
attackPhase = 2;
|
||||
setImage("2Combo1.png");
|
||||
setImage(defaultAnimation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
}
|
||||
else{
|
||||
attackPhase = 2;
|
||||
setImage("2Combo1.png");
|
||||
setImage(defaultAnimation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
}
|
||||
}
|
||||
if (attacking && attackPhase == 2 && System.currentTimeMillis() - attackTimer >= 300) {
|
||||
if (attacking && attackPhase == 2 && System.currentTimeMillis() - attackTimer >= (int)(500/speedFaktor)) {
|
||||
attacking = false;
|
||||
attackPhase = 0;
|
||||
d = 0;
|
||||
}
|
||||
if (attacking2 && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= (int)(550/speedFaktor2)) {
|
||||
if(schautNachRechts){
|
||||
attackPhase = 2;
|
||||
setImage(attacke2Animation2);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
}
|
||||
else{
|
||||
attackPhase = 2;
|
||||
setImage(attacke2Animation2);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
}
|
||||
}
|
||||
if (attacking2 && attackPhase == 2 && System.currentTimeMillis() - attackTimer >= (int)(800/speedFaktor2)) {
|
||||
attacking2 = false;
|
||||
attackPhase = 0;
|
||||
e = 0;
|
||||
if(schautNachRechts){
|
||||
setImage(defaultAnimation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
}
|
||||
else{
|
||||
setImage(defaultAnimation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void anitmationLaufen(){
|
||||
if(laeuft){
|
||||
public void animationLaufen(){
|
||||
if(laeuft &! attacking &! attacking2){
|
||||
if(schautNachRechts){
|
||||
if(laufPhase == 0){
|
||||
setImage("RenRun1.png");
|
||||
setImage(walk1);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
laufPhase = 1;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
}
|
||||
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 100){
|
||||
setImage("RenRun2.png");
|
||||
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 200){
|
||||
setImage(walk2);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
laufPhase = 2;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
}
|
||||
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 100){
|
||||
setImage("RenRun3.png");
|
||||
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 200){
|
||||
setImage(walk3);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
laufPhase = 3;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
}
|
||||
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 100){
|
||||
setImage("RenRun4.png");
|
||||
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 200){
|
||||
setImage(walk4);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
laufPhase = 4;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
}
|
||||
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 100){
|
||||
setImage("2Combo1.png");
|
||||
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 200){
|
||||
setImage(defaultAnimation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
laufPhase = 0;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
@@ -180,45 +274,45 @@ public class Player2 extends Actor
|
||||
}
|
||||
else{
|
||||
if(laufPhase == 0){
|
||||
setImage("RenRun1.png");
|
||||
setImage(walk1);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
laufPhase = 1;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
}
|
||||
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 100){
|
||||
setImage("RenRun2.png");
|
||||
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 200){
|
||||
setImage(walk2);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
laufPhase = 2;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
}
|
||||
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 100){
|
||||
setImage("RenRun3.png");
|
||||
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 200){
|
||||
setImage(walk3);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
laufPhase = 3;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
}
|
||||
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 100){
|
||||
setImage("RenRun4.png");
|
||||
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 200){
|
||||
setImage(walk4);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
laufPhase = 4;
|
||||
laufTimer = System.currentTimeMillis();
|
||||
}
|
||||
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 100){
|
||||
setImage("2Combo1.png");
|
||||
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 200){
|
||||
setImage(defaultAnimation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160, 160);
|
||||
image.scale(250, 250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
laufPhase = 0;
|
||||
@@ -240,12 +334,57 @@ public class Player2 extends Actor
|
||||
|
||||
public void charakter(){
|
||||
if(charakter == 1){
|
||||
setImage("2Combo1.png");
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(160,160);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
defaultAnimation = "2Combo1.png";
|
||||
attacke1Animation = "1Combo2.png";
|
||||
attacke2Animation1 = "3Combo2.png";
|
||||
attacke2Animation2 = defaultAnimation;
|
||||
walk1 = "RenRun1.png";
|
||||
walk2 = "RenRun2.png";
|
||||
walk3 = "RenRun3.png";
|
||||
walk4 = "RenRun4.png";
|
||||
attack2Duration = 1;
|
||||
speed = 6;
|
||||
maxLeben = 100;
|
||||
leben = maxLeben;
|
||||
speedFaktor = 1;
|
||||
speedFaktor2 = speedFaktor;
|
||||
}
|
||||
|
||||
if(charakter == 2){
|
||||
defaultAnimation = "Tetsu1Combo1.png";
|
||||
attacke1Animation = "Tetsu1Combo2.png";
|
||||
attacke2Animation1 = "Tetsu3Combo1.png";
|
||||
attacke2Animation2 = "Tetsu3Combo2.png";
|
||||
walk1 = "TetsuRun1.png";
|
||||
walk2 = "TetsuRun2.png";
|
||||
walk3 = "TetsuRun3.png";
|
||||
walk4 = "TetsuRun4.png";
|
||||
attack2Duration = 2;
|
||||
speed = 4;
|
||||
maxLeben = 130;
|
||||
leben = maxLeben;
|
||||
speedFaktor = 0.5;
|
||||
speedFaktor2 = 0.75;
|
||||
}
|
||||
if(charakter == 3){
|
||||
defaultAnimation = "HinataShoot1.png";
|
||||
attacke1Animation = "Hinata2Combo1.png";
|
||||
attacke2Animation1 = "Hinata3Combo1.png";
|
||||
attacke2Animation2 = defaultAnimation;
|
||||
walk1 = "HinataRun1.png";
|
||||
walk2 = "HinataRun2.png";
|
||||
walk3 = "HinataRun3.png";
|
||||
walk4 = "HinataRun4.png";
|
||||
attack2Duration = 1;
|
||||
speed = 8;
|
||||
maxLeben = 80;
|
||||
leben = maxLeben;
|
||||
speedFaktor = 2;
|
||||
speedFaktor2 = 8;
|
||||
}
|
||||
setImage(defaultAnimation);
|
||||
GreenfootImage image = getImage();
|
||||
image.scale(250,250);
|
||||
setImage(image);
|
||||
getImage().mirrorHorizontally();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user