Compare commits

...

2 Commits

Author SHA1 Message Date
Max 40867c7800 Files2 2026-09-17 11:16:32 +02:00
Max 0c0e0f39da -Dash
-DashAttack
-neue Springenmethode
-block
2026-09-17 11:14:29 +02:00
35 changed files with 541 additions and 71 deletions
Binary file not shown.
+108 -4
View File
@@ -57,30 +57,134 @@ public class MyWorld extends World
} }
public void act(){ public void act(){
if(player1.attacke()){ if(player1.attacke() &! player2.isBlocking){
if(player1.getX() - player2.getX() < attack1Distance && player1.getX() - player2.getX() > -attack1Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){ if(player1.getX() - player2.getX() < attack1Distance && player1.getX() - player2.getX() > -attack1Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player2.leben = player2.leben -attack1Strength; player2.leben = player2.leben -attack1Strength;
setPaintOrder(Player1.class,Player2.class); setPaintOrder(Player1.class,Player2.class);
if(player2.schautNachRechts){
player2.setImage(player2.hitAnimation);
GreenfootImage image = player2.getImage();
image.scale(250, 250);
player2.setImage(image);
}
else{
player2.setImage(player2.hitAnimation);
GreenfootImage image = player2.getImage();
image.scale(250, 250);
player2.setImage(image);
player2.getImage().mirrorHorizontally();
}
player2.hitTimer = System.currentTimeMillis() + 250;
player2.gotHit = true;
} }
} }
if(player2.attacke()){ if(player2.attacke() &! player1.isBlocking){
if(player1.getX() - player2.getX() < attack1Distance && player1.getX() - player2.getX() > -attack1Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){ if(player1.getX() - player2.getX() < attack1Distance && player1.getX() - player2.getX() > -attack1Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player1.leben = player1.leben -attack1Strength; player1.leben = player1.leben -attack1Strength;
setPaintOrder(Player2.class,Player1.class); setPaintOrder(Player2.class,Player1.class);
if(player1.schautNachRechts){
player1.setImage(player1.hitAnimation);
GreenfootImage image = player1.getImage();
image.scale(250, 250);
player1.setImage(image);
}
else{
player1.setImage(player1.hitAnimation);
GreenfootImage image = player1.getImage();
image.scale(250, 250);
player1.setImage(image);
player1.getImage().mirrorHorizontally();
}
player1.hitTimer = System.currentTimeMillis() + 250;
player1.gotHit = true;
} }
} }
if(player1.attacke2()){ if(player1.attacke2() &! player2.isBlocking){
if(player1.getX() - player2.getX() < attack2Distance && player1.getX() - player2.getX() > -attack2Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){ if(player1.getX() - player2.getX() < attack2Distance && player1.getX() - player2.getX() > -attack2Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player2.leben = player2.leben -attack2Strength; player2.leben = player2.leben -attack2Strength;
setPaintOrder(Player1.class,Player2.class); setPaintOrder(Player1.class,Player2.class);
if(player2.schautNachRechts){
player2.setImage(player2.hitAnimation);
GreenfootImage image = player2.getImage();
image.scale(250, 250);
player2.setImage(image);
}
else{
player2.setImage(player2.hitAnimation);
GreenfootImage image = player2.getImage();
image.scale(250, 250);
player2.setImage(image);
player2.getImage().mirrorHorizontally();
}
player2.hitTimer = System.currentTimeMillis() + 250;
player2.gotHit = true;
} }
} }
if(player2.attacke2()){ if(player2.attacke2() &! player1.isBlocking){
if(player1.getX() - player2.getX() < attack2Distance && player1.getX() - player2.getX() > -attack2Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){ if(player1.getX() - player2.getX() < attack2Distance && player1.getX() - player2.getX() > -attack2Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player1.leben = player1.leben -attack2Strength; player1.leben = player1.leben -attack2Strength;
setPaintOrder(Player2.class,Player1.class); setPaintOrder(Player2.class,Player1.class);
if(player1.schautNachRechts){
player1.setImage(player1.hitAnimation);
GreenfootImage image = player1.getImage();
image.scale(250, 250);
player1.setImage(image);
}
else{
player1.setImage(player1.hitAnimation);
GreenfootImage image = player1.getImage();
image.scale(250, 250);
player1.setImage(image);
player1.getImage().mirrorHorizontally();
}
player1.hitTimer = System.currentTimeMillis() + 250;
player1.gotHit = true;
} }
} }
if(player1.dashAttack()){
if(player1.getX() - player2.getX() < attack2Distance && player1.getX() - player2.getX() > -attack2Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player2.isBlocking = false;
player2.leben = player2.leben -attack2Strength;
setPaintOrder(Player1.class,Player2.class);
if(player2.schautNachRechts){
player2.setImage(player2.hitAnimation);
GreenfootImage image = player2.getImage();
image.scale(250, 250);
player2.setImage(image);
}
else{
player2.setImage(player2.hitAnimation);
GreenfootImage image = player2.getImage();
image.scale(250, 250);
player2.setImage(image);
player2.getImage().mirrorHorizontally();
}
player2.hitTimer = System.currentTimeMillis() + 250;
player2.gotHit = true;
}
}
if(player2.dashAttack()){
if(player1.getX() - player2.getX() < attack2Distance && player1.getX() - player2.getX() > -attack2Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player1.isBlocking = false;
player1.leben = player1.leben -attack2Strength;
setPaintOrder(Player2.class,Player1.class);
if(player1.schautNachRechts){
player1.setImage(player1.hitAnimation);
GreenfootImage image = player1.getImage();
image.scale(250, 250);
player1.setImage(image);
}
else{
player1.setImage(player1.hitAnimation);
GreenfootImage image = player1.getImage();
image.scale(250, 250);
player1.setImage(image);
player1.getImage().mirrorHorizontally();
}
player1.hitTimer = System.currentTimeMillis() + 250;
player1.gotHit = true;
}
}
showText(String.valueOf(player2.leben),450,40); showText(String.valueOf(player2.leben),450,40);
showText(String.valueOf(player1.leben),150,40); showText(String.valueOf(player1.leben),150,40);
l1.leben(player1.leben, player1.maxLeben); l1.leben(player1.leben, player1.maxLeben);
Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.
+21 -7
View File
@@ -4,7 +4,21 @@ comment0.text=\r\n\ Write\ a\ description\ of\ class\ player\ here.\r\n\ \r\n\ @
comment1.params=pCharakter comment1.params=pCharakter
comment1.target=Player1(int) comment1.target=Player1(int)
comment10.params= comment10.params=
comment10.target=void\ charakter() comment10.target=boolean\ dashAttack()
comment11.params=
comment11.target=void\ dashAttackAnimation()
comment12.params=pRechts
comment12.target=void\ dashAnimation(int)
comment13.params=
comment13.target=void\ animation1()
comment14.params=
comment14.target=void\ animationLaufen()
comment15.params=
comment15.target=void\ gotHit()
comment16.params=
comment16.target=void\ block()
comment17.params=
comment17.target=void\ charakter()
comment2.params= comment2.params=
comment2.target=void\ act() comment2.target=void\ act()
comment3.params= comment3.params=
@@ -12,13 +26,13 @@ comment3.target=void\ bewegung()
comment4.params= comment4.params=
comment4.target=void\ springen() comment4.target=void\ springen()
comment5.params= comment5.params=
comment5.target=boolean\ attacke() comment5.target=void\ gravitation()
comment6.params= comment6.params=
comment6.target=boolean\ attacke2() comment6.target=void\ fall()
comment7.params= comment7.params=
comment7.target=void\ animation1() comment7.target=boolean\ attacke()
comment8.params= comment8.params=
comment8.target=void\ animationLaufen() comment8.target=boolean\ attacke2()
comment9.params= comment9.params=
comment9.target=void\ gravitation() comment9.target=void\ dash()
numComments=11 numComments=18
+193 -24
View File
@@ -19,6 +19,7 @@ public class Player1 extends Actor
long d = 0; long d = 0;
long e = 0; long e = 0;
boolean schautNachRechts; boolean schautNachRechts;
int schautNachRechts2;
long attackTimer = 0; long attackTimer = 0;
int attackPhase = 0; int attackPhase = 0;
boolean attacking = false; boolean attacking = false;
@@ -35,10 +36,27 @@ public class Player1 extends Actor
String walk2; String walk2;
String walk3; String walk3;
String walk4; String walk4;
String dashAnimation;
String hitAnimation;
String dashAttackAnimation;
String blockAnimation;
int attack2Duration; int attack2Duration;
int speed; int speed;
double speedFaktor; double speedFaktor;
double speedFaktor2; double speedFaktor2;
long dashTimer;
long jumpTimer = 0;
int vSpeed = 0;
int meereshoehe = 289;
int vDashSpeed = 0;
int vDashSpeedCharakter;
boolean gotHit = false;
long hitTimer = 0;
long dashAttackTimer = 0;
boolean isDash = false;
boolean isDashAttack = false;
long dashAttackTimer2 = 0;
boolean isBlocking = false;
Player1(int pCharakter){ Player1(int pCharakter){
charakter = pCharakter; charakter = pCharakter;
@@ -52,10 +70,15 @@ public class Player1 extends Actor
springen(); springen();
animation1(); animation1();
animationLaufen(); animationLaufen();
dash();
dashAnimation(schautNachRechts2);
dashAttackAnimation();
gotHit();
block();
} }
public void bewegung(){ public void bewegung(){
if(Greenfoot.isKeyDown("d")){ if(Greenfoot.isKeyDown("d") &! isBlocking){
setRotation(0); setRotation(0);
move(speed); move(speed);
if(!schautNachRechts && attackPhase == 0){ if(!schautNachRechts && attackPhase == 0){
@@ -66,7 +89,7 @@ public class Player1 extends Actor
attacke(); attacke();
attacke2(); attacke2();
} }
if(Greenfoot.isKeyDown("a")){ if(Greenfoot.isKeyDown("a") &! isBlocking){
setRotation(0); setRotation(0);
move(-speed); move(-speed);
if(schautNachRechts && attackPhase == 0){ if(schautNachRechts && attackPhase == 0){
@@ -78,24 +101,35 @@ public class Player1 extends Actor
attacke2(); attacke2();
} }
} }
public void springen() {
public void springen(){ if (Greenfoot.isKeyDown("space") && getY() >= meereshoehe &! isBlocking) {
if(Greenfoot.isKeyDown("space") && this.getY() > 289 ){ vSpeed = -15;
for(int i = 12; i > -12; i--){ fall();
setRotation(270); }
move(i); }
setRotation(0);
Greenfoot.delay(1); public void gravitation() {
bewegung(); if (getY() < meereshoehe || vSpeed < 0) {
attacke(); fall();
attacke2(); } else {
} vSpeed = 0;
} setLocation(getX(), meereshoehe);
}
}
private void fall() {
setLocation(getX(), getY() + vSpeed);
vSpeed += 1;
} }
public boolean attacke(){ public boolean attacke(){
if(System.currentTimeMillis() >= c){ if(System.currentTimeMillis() >= c &! isBlocking){
if(Greenfoot.isKeyDown("e")){ GreenfootImage img = getImage();
setImage(dashAnimation);
GreenfootImage img2 = getImage();
setImage(img);
if(Greenfoot.isKeyDown("e") &! isDash){
if (!attacking && !attacking2) { if (!attacking && !attacking2) {
attacking = true; attacking = true;
attackPhase = 1; attackPhase = 1;
@@ -131,7 +165,7 @@ public class Player1 extends Actor
} }
public boolean attacke2(){ public boolean attacke2(){
if(System.currentTimeMillis() >= c){ if(System.currentTimeMillis() >= c &! isBlocking){
if(Greenfoot.isKeyDown("q")){ if(Greenfoot.isKeyDown("q")){
if (!attacking2 && !attacking) { if (!attacking2 && !attacking) {
attacking2 = true; attacking2 = true;
@@ -167,6 +201,97 @@ public class Player1 extends Actor
} }
} }
public void dash(){
if(Greenfoot.isKeyDown("f") && System.currentTimeMillis() >= dashTimer &! isBlocking){
if(schautNachRechts){
vDashSpeed = vDashSpeedCharakter;
schautNachRechts2 = 1;
dashAnimation(schautNachRechts2);
}
else{
vDashSpeed = -vDashSpeedCharakter;
schautNachRechts2 = 0;
dashAnimation(schautNachRechts2);
}
isDash = true;
dashTimer = System.currentTimeMillis() + 1000;
}
}
public boolean dashAttack(){
if(isDash && Greenfoot.isKeyDown("e") && System.currentTimeMillis() >= dashAttackTimer &! isBlocking){
dashAttackTimer = System.currentTimeMillis() + 300;
dashAttackTimer2 = System.currentTimeMillis() + 300;
isDashAttack = true;
return true;
}
else{
return false;
}
}
public void dashAttackAnimation(){
if(isDashAttack){
setImage(dashAttackAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
if(schautNachRechts2 == 0){
getImage().mirrorHorizontally();
}
if(System.currentTimeMillis() >= dashAttackTimer2){
setImage(defaultAnimation);
image = getImage();
image.scale(250, 250);
setImage(image);
if(schautNachRechts2 == 0){
getImage().mirrorHorizontally();
}
isDashAttack = false;
}
}
}
public void dashAnimation(int pRechts){
if(vDashSpeed != 0){
if(pRechts == 1){
setImage(dashAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
setLocation(getX() + vDashSpeed, getY());
vDashSpeed -= 1;
if(vDashSpeed == 0){
setImage(defaultAnimation);
image = getImage();
image.scale(250, 250);
setImage(image);
}
}
if(pRechts == 0){
setImage(dashAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
getImage().mirrorHorizontally();
setLocation(getX() + vDashSpeed, getY());
vDashSpeed += 1;
if(vDashSpeed == 0){
setImage(defaultAnimation);
image = getImage();
image.scale(250, 250);
setImage(image);
getImage().mirrorHorizontally();
}
}
}
else{
isDash = false;
}
}
public void animation1(){ public void animation1(){
if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= (int)(200/speedFaktor)) { if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= (int)(200/speedFaktor)) {
if(schautNachRechts){ if(schautNachRechts){
@@ -323,12 +448,39 @@ public class Player1 extends Actor
} }
} }
public void gravitation(){ public void gotHit(){
if(this.getY() < 290){ if(System.currentTimeMillis() >= hitTimer && gotHit){
setRotation(90); setImage(defaultAnimation);
move(4); GreenfootImage image = getImage();
setRotation(0); image.scale(250, 250);
setImage(image);
if(!schautNachRechts){
getImage().mirrorHorizontally();
}
gotHit = false;
}
}
public void block(){
if(Greenfoot.isKeyDown("r")){
isBlocking = true;
setImage(blockAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
if(!schautNachRechts){
getImage().mirrorHorizontally();
}
}
if(isBlocking &! Greenfoot.isKeyDown("r")){
isBlocking = false;
setImage(defaultAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
if(!schautNachRechts){
getImage().mirrorHorizontally();
}
} }
} }
@@ -342,12 +494,17 @@ public class Player1 extends Actor
walk2 = "RenRun2.png"; walk2 = "RenRun2.png";
walk3 = "RenRun3.png"; walk3 = "RenRun3.png";
walk4 = "RenRun4.png"; walk4 = "RenRun4.png";
dashAnimation = "RenDashForward.png";
hitAnimation = "RenHit.png";
dashAttackAnimation = "RenDashForwardAttack.png";
blockAnimation = "RenBlock.png";
attack2Duration = 1; attack2Duration = 1;
speed = 6; speed = 6;
maxLeben = 100; maxLeben = 100;
leben = maxLeben; leben = maxLeben;
speedFaktor = 1; speedFaktor = 1;
speedFaktor2 = speedFaktor; speedFaktor2 = speedFaktor;
vDashSpeedCharakter = 12;
} }
if(charakter == 2){ if(charakter == 2){
defaultAnimation = "Tetsu1Combo1.png"; defaultAnimation = "Tetsu1Combo1.png";
@@ -358,12 +515,17 @@ public class Player1 extends Actor
walk2 = "TetsuRun2.png"; walk2 = "TetsuRun2.png";
walk3 = "TetsuRun3.png"; walk3 = "TetsuRun3.png";
walk4 = "TetsuRun4.png"; walk4 = "TetsuRun4.png";
dashAnimation = "TetsuDashForward.png";
hitAnimation = "TetsuHit.png";
dashAttackAnimation = "TetsuDashForwardAttack.png";
blockAnimation = "TetsuBlock.png";
attack2Duration = 2; attack2Duration = 2;
speed = 4; speed = 4;
maxLeben = 130; maxLeben = 130;
leben = maxLeben; leben = maxLeben;
speedFaktor = 0.5; speedFaktor = 0.5;
speedFaktor2 = 0.75; speedFaktor2 = 0.75;
vDashSpeedCharakter = 10;
} }
if(charakter == 3){ if(charakter == 3){
defaultAnimation = "HinataShoot1.png"; defaultAnimation = "HinataShoot1.png";
@@ -374,16 +536,23 @@ public class Player1 extends Actor
walk2 = "HinataRun2.png"; walk2 = "HinataRun2.png";
walk3 = "HinataRun3.png"; walk3 = "HinataRun3.png";
walk4 = "HinataRun4.png"; walk4 = "HinataRun4.png";
dashAnimation = "HinataDashForward.png";
hitAnimation = "HinataHit.png";
dashAttackAnimation = "HinataDashForwardAttack.png";
blockAnimation = "HinataBlock.png";
attack2Duration = 1; attack2Duration = 1;
speed = 8; speed = 8;
maxLeben = 80; maxLeben = 80;
leben = maxLeben; leben = maxLeben;
speedFaktor = 2; speedFaktor = 2;
speedFaktor2 = 8; speedFaktor2 = 8;
vDashSpeedCharakter = 14;
} }
setImage(defaultAnimation); setImage(defaultAnimation);
GreenfootImage image = getImage(); GreenfootImage image = getImage();
image.scale(250,250); image.scale(250,250);
setImage(image); setImage(image);
} }
} }
Binary file not shown.
+21 -7
View File
@@ -4,7 +4,21 @@ comment0.text=\r\n\ Write\ a\ description\ of\ class\ player\ here.\r\n\ \r\n\ @
comment1.params=pCharakter comment1.params=pCharakter
comment1.target=Player2(int) comment1.target=Player2(int)
comment10.params= comment10.params=
comment10.target=void\ charakter() comment10.target=boolean\ dashAttack()
comment11.params=
comment11.target=void\ dashAttackAnimation()
comment12.params=pRechts
comment12.target=void\ dashAnimation(int)
comment13.params=
comment13.target=void\ animation1()
comment14.params=
comment14.target=void\ animationLaufen()
comment15.params=
comment15.target=void\ gotHit()
comment16.params=
comment16.target=void\ block()
comment17.params=
comment17.target=void\ charakter()
comment2.params= comment2.params=
comment2.target=void\ act() comment2.target=void\ act()
comment3.params= comment3.params=
@@ -12,13 +26,13 @@ comment3.target=void\ bewegung()
comment4.params= comment4.params=
comment4.target=void\ springen() comment4.target=void\ springen()
comment5.params= comment5.params=
comment5.target=boolean\ attacke() comment5.target=void\ gravitation()
comment6.params= comment6.params=
comment6.target=boolean\ attacke2() comment6.target=void\ fall()
comment7.params= comment7.params=
comment7.target=void\ animation1() comment7.target=boolean\ attacke()
comment8.params= comment8.params=
comment8.target=void\ animationLaufen() comment8.target=boolean\ attacke2()
comment9.params= comment9.params=
comment9.target=void\ gravitation() comment9.target=void\ dash()
numComments=11 numComments=18
+194 -25
View File
@@ -19,6 +19,7 @@ public class Player2 extends Actor
long d = 0; long d = 0;
long e = 0; long e = 0;
boolean schautNachRechts; boolean schautNachRechts;
int schautNachRechts2;
long attackTimer = 0; long attackTimer = 0;
int attackPhase = 0; int attackPhase = 0;
boolean attacking = false; boolean attacking = false;
@@ -35,10 +36,27 @@ public class Player2 extends Actor
String walk2; String walk2;
String walk3; String walk3;
String walk4; String walk4;
String dashAnimation;
String hitAnimation;
String dashAttackAnimation;
String blockAnimation;
int attack2Duration; int attack2Duration;
int speed; int speed;
double speedFaktor; double speedFaktor;
double speedFaktor2; double speedFaktor2;
long dashTimer;
long jumpTimer = 0;
int vSpeed = 0;
int meereshoehe = 289;
int vDashSpeed = 0;
int vDashSpeedCharakter;
boolean gotHit = false;
long hitTimer = 0;
long dashAttackTimer = 0;
boolean isDash = false;
boolean isDashAttack = false;
long dashAttackTimer2 = 0;
boolean isBlocking = false;
Player2(int pCharakter){ Player2(int pCharakter){
charakter = pCharakter; charakter = pCharakter;
@@ -52,10 +70,15 @@ public class Player2 extends Actor
springen(); springen();
animation1(); animation1();
animationLaufen(); animationLaufen();
dash();
dashAnimation(schautNachRechts2);
dashAttackAnimation();
gotHit();
block();
} }
public void bewegung(){ public void bewegung(){
if(Greenfoot.isKeyDown("l")){ if(Greenfoot.isKeyDown("p") &! isBlocking){
setRotation(0); setRotation(0);
move(speed); move(speed);
if(!schautNachRechts && attackPhase == 0){ if(!schautNachRechts && attackPhase == 0){
@@ -66,7 +89,7 @@ public class Player2 extends Actor
attacke(); attacke();
attacke2(); attacke2();
} }
if(Greenfoot.isKeyDown("j")){ if(Greenfoot.isKeyDown("i") &! isBlocking){
setRotation(0); setRotation(0);
move(-speed); move(-speed);
if(schautNachRechts && attackPhase == 0){ if(schautNachRechts && attackPhase == 0){
@@ -78,24 +101,35 @@ public class Player2 extends Actor
attacke2(); attacke2();
} }
} }
public void springen() {
public void springen(){ if (Greenfoot.isKeyDown("o") && getY() >= meereshoehe &! isBlocking) {
if(Greenfoot.isKeyDown("i") && this.getY() > 289 ){ vSpeed = -15;
for(int i = 12; i > -12; i--){ fall();
setRotation(270); }
move(i); }
setRotation(0);
Greenfoot.delay(1); public void gravitation() {
bewegung(); if (getY() < meereshoehe || vSpeed < 0) {
attacke(); fall();
attacke2(); } else {
} vSpeed = 0;
} setLocation(getX(), meereshoehe);
}
}
private void fall() {
setLocation(getX(), getY() + vSpeed);
vSpeed += 1;
} }
public boolean attacke(){ public boolean attacke(){
if(System.currentTimeMillis() >= c){ if(System.currentTimeMillis() >= c &! isBlocking){
if(Greenfoot.isKeyDown("o")){ GreenfootImage img = getImage();
setImage(dashAnimation);
GreenfootImage img2 = getImage();
setImage(img);
if(Greenfoot.isKeyDown("j") &! isDash){
if (!attacking && !attacking2) { if (!attacking && !attacking2) {
attacking = true; attacking = true;
attackPhase = 1; attackPhase = 1;
@@ -131,8 +165,8 @@ public class Player2 extends Actor
} }
public boolean attacke2(){ public boolean attacke2(){
if(System.currentTimeMillis() >= c){ if(System.currentTimeMillis() >= c &! isBlocking){
if(Greenfoot.isKeyDown("u")){ if(Greenfoot.isKeyDown("n")){
if (!attacking2 && !attacking) { if (!attacking2 && !attacking) {
attacking2 = true; attacking2 = true;
attackPhase = 1; attackPhase = 1;
@@ -167,6 +201,97 @@ public class Player2 extends Actor
} }
} }
public void dash(){
if(Greenfoot.isKeyDown("u") && System.currentTimeMillis() >= dashTimer &! isBlocking){
if(schautNachRechts){
vDashSpeed = vDashSpeedCharakter;
schautNachRechts2 = 1;
dashAnimation(schautNachRechts2);
}
else{
vDashSpeed = -vDashSpeedCharakter;
schautNachRechts2 = 0;
dashAnimation(schautNachRechts2);
}
isDash = true;
dashTimer = System.currentTimeMillis() + 1000;
}
}
public boolean dashAttack(){
if(isDash && Greenfoot.isKeyDown("j") && System.currentTimeMillis() >= dashAttackTimer &! isBlocking){
dashAttackTimer = System.currentTimeMillis() + 300;
dashAttackTimer2 = System.currentTimeMillis() + 300;
isDashAttack = true;
return true;
}
else{
return false;
}
}
public void dashAttackAnimation(){
if(isDashAttack){
setImage(dashAttackAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
if(schautNachRechts2 == 0){
getImage().mirrorHorizontally();
}
if(System.currentTimeMillis() >= dashAttackTimer2){
setImage(defaultAnimation);
image = getImage();
image.scale(250, 250);
setImage(image);
if(schautNachRechts2 == 0){
getImage().mirrorHorizontally();
}
isDashAttack = false;
}
}
}
public void dashAnimation(int pRechts){
if(vDashSpeed != 0){
if(pRechts == 1){
setImage(dashAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
setLocation(getX() + vDashSpeed, getY());
vDashSpeed -= 1;
if(vDashSpeed == 0){
setImage(defaultAnimation);
image = getImage();
image.scale(250, 250);
setImage(image);
}
}
if(pRechts == 0){
setImage(dashAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
getImage().mirrorHorizontally();
setLocation(getX() + vDashSpeed, getY());
vDashSpeed += 1;
if(vDashSpeed == 0){
setImage(defaultAnimation);
image = getImage();
image.scale(250, 250);
setImage(image);
getImage().mirrorHorizontally();
}
}
}
else{
isDash = false;
}
}
public void animation1(){ public void animation1(){
if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= (int)(200/speedFaktor)) { if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= (int)(200/speedFaktor)) {
if(schautNachRechts){ if(schautNachRechts){
@@ -323,12 +448,39 @@ public class Player2 extends Actor
} }
} }
public void gravitation(){ public void gotHit(){
if(this.getY() < 290){ if(System.currentTimeMillis() >= hitTimer && gotHit){
setRotation(90); setImage(defaultAnimation);
move(4); GreenfootImage image = getImage();
setRotation(0); image.scale(250, 250);
setImage(image);
if(!schautNachRechts){
getImage().mirrorHorizontally();
}
gotHit = false;
}
}
public void block(){
if(Greenfoot.isKeyDown("k")){
isBlocking = true;
setImage(blockAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
if(!schautNachRechts){
getImage().mirrorHorizontally();
}
}
if(isBlocking &! Greenfoot.isKeyDown("k")){
isBlocking = false;
setImage(defaultAnimation);
GreenfootImage image = getImage();
image.scale(250, 250);
setImage(image);
if(!schautNachRechts){
getImage().mirrorHorizontally();
}
} }
} }
@@ -342,12 +494,17 @@ public class Player2 extends Actor
walk2 = "RenRun2.png"; walk2 = "RenRun2.png";
walk3 = "RenRun3.png"; walk3 = "RenRun3.png";
walk4 = "RenRun4.png"; walk4 = "RenRun4.png";
dashAnimation = "RenDashForward.png";
hitAnimation = "RenHit.png";
dashAttackAnimation = "RenDashForwardAttack.png";
blockAnimation = "RenBlock.png";
attack2Duration = 1; attack2Duration = 1;
speed = 6; speed = 6;
maxLeben = 100; maxLeben = 100;
leben = maxLeben; leben = maxLeben;
speedFaktor = 1; speedFaktor = 1;
speedFaktor2 = speedFaktor; speedFaktor2 = speedFaktor;
vDashSpeedCharakter = 12;
} }
if(charakter == 2){ if(charakter == 2){
defaultAnimation = "Tetsu1Combo1.png"; defaultAnimation = "Tetsu1Combo1.png";
@@ -358,12 +515,17 @@ public class Player2 extends Actor
walk2 = "TetsuRun2.png"; walk2 = "TetsuRun2.png";
walk3 = "TetsuRun3.png"; walk3 = "TetsuRun3.png";
walk4 = "TetsuRun4.png"; walk4 = "TetsuRun4.png";
dashAnimation = "TetsuDashForward.png";
hitAnimation = "TetsuHit.png";
dashAttackAnimation = "TetsuDashForwardAttack.png";
blockAnimation = "TetsuBlock.png";
attack2Duration = 2; attack2Duration = 2;
speed = 4; speed = 4;
maxLeben = 130; maxLeben = 130;
leben = maxLeben; leben = maxLeben;
speedFaktor = 0.5; speedFaktor = 0.5;
speedFaktor2 = 0.75; speedFaktor2 = 0.75;
vDashSpeedCharakter = 10;
} }
if(charakter == 3){ if(charakter == 3){
defaultAnimation = "HinataShoot1.png"; defaultAnimation = "HinataShoot1.png";
@@ -374,12 +536,17 @@ public class Player2 extends Actor
walk2 = "HinataRun2.png"; walk2 = "HinataRun2.png";
walk3 = "HinataRun3.png"; walk3 = "HinataRun3.png";
walk4 = "HinataRun4.png"; walk4 = "HinataRun4.png";
dashAnimation = "HinataDashForward.png";
hitAnimation = "HinataHit.png";
dashAttackAnimation = "HinataDashForwardAttack.png";
blockAnimation = "HinataBlock.png";
attack2Duration = 1; attack2Duration = 1;
speed = 8; speed = 8;
maxLeben = 80; maxLeben = 80;
leben = maxLeben; leben = maxLeben;
speedFaktor = 2; speedFaktor = 2;
speedFaktor2 = 8; speedFaktor2 = 8;
vDashSpeedCharakter = 14;
} }
setImage(defaultAnimation); setImage(defaultAnimation);
GreenfootImage image = getImage(); GreenfootImage image = getImage();
@@ -387,4 +554,6 @@ public class Player2 extends Actor
setImage(image); setImage(image);
getImage().mirrorHorizontally(); getImage().mirrorHorizontally();
} }
} }
+4 -4
View File
@@ -37,10 +37,10 @@ dependency8.type=UsesDependency
dependency9.from=MyWorld dependency9.from=MyWorld
dependency9.to=Lebensanzeige dependency9.to=Lebensanzeige
dependency9.type=UsesDependency dependency9.type=UsesDependency
editor.fx.0.height=678 editor.fx.0.height=686
editor.fx.0.width=604 editor.fx.0.width=1294
editor.fx.0.x=682 editor.fx.0.x=-7
editor.fx.0.y=0 editor.fx.0.y=-7
height=686 height=686
package.numDependencies=11 package.numDependencies=11
package.numTargets=9 package.numTargets=9