Compare commits

..

14 Commits

Author SHA1 Message Date
Max 8a02a796a8 Final 2026-09-17 20:00:38 +02:00
Max 9fa05786d2 Beta1 2026-09-17 17:02:54 +02:00
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
Max 988c8196f6 Files 2026-09-16 17:13:09 +02:00
Max 8f4f730c72 Files 2026-09-16 17:13:03 +02:00
Max 700eef1064 ALLES 2026-09-16 17:10:54 +02:00
Max 4d98573c7c - Lebensanzeige
- walk Animation fertig
2026-09-15 21:04:26 +02:00
Max 067d36033d - Lebensanzeige
- walk Animation fertig
2026-09-15 21:04:11 +02:00
Max 60d21d5f68 - Start World to Game World 2026-09-15 19:35:25 +02:00
Leif cce1abcc81 Endscreen erstellt 2026-09-15 19:27:12 +02:00
Max 6b842a7b75 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	fighter/project.greenfoot
2026-09-15 19:14:59 +02:00
Max 67db7a5e48 test file 2026-09-15 19:14:23 +02:00
Max 6e7ff8d2eb - Spieler Attacke, Animation 2026-09-15 19:13:35 +02:00
156 changed files with 2654 additions and 230 deletions
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
#BlueJ class context
comment0.target=EndWorld
comment0.text=\r\n\ Write\ a\ description\ of\ class\ GameOverWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params=pSieger
comment1.target=EndWorld(java.lang.String)
comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ GameOverWorld.\r\n\ \r\n
comment2.params=
comment2.target=void\ act()
numComments=3
+31
View File
@@ -0,0 +1,31 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class GameOverWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class EndWorld extends World
{
/**
* Constructor for objects of class GameOverWorld.
*
*/
public EndWorld(String pSieger)
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
showText("GAME OVER", 300, 70);
showText("the winner is " + pSieger, 300, 220);
showText("Drücke R für einen Neustart", 300, 340);
setBackground(new GreenfootImage("GameOverSreen.png"));
}
public void act(){
if (Greenfoot.isKeyDown("r")){
Greenfoot.setWorld(new MenuWorld());
}
}
}
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
#BlueJ class context
comment0.target=Lebensanzeige
comment0.text=\r\n\ Write\ a\ description\ of\ class\ LebensanzeigeP1\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params=
comment1.target=Lebensanzeige()
comment1.text=\r\n\ Act\ -\ do\ whatever\ the\ LebensanzeigeP1\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n
comment2.params=
comment2.target=void\ act()
comment3.params=pLeben\ pMaxLeben
comment3.target=void\ leben(double,\ double)
numComments=4
+35
View File
@@ -0,0 +1,35 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class LebensanzeigeP1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Lebensanzeige extends Actor
{
/**
* Act - do whatever the LebensanzeigeP1 wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
Lebensanzeige(){
setImage("green.png");
GreenfootImage image = getImage();
image.scale(200,15);
setImage(image);
}
public void act()
{
}
public void leben(double pLeben, double pMaxLeben){
if(pLeben > 0){
setImage("green.png");
GreenfootImage image = getImage();
image.scale((int)(200 * (pLeben/pMaxLeben)),15);
setImage(image);
}
}
}
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
#BlueJ class context
comment0.target=MenuWorld
comment0.text=\r\n\ Write\ a\ description\ of\ class\ StartWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params=
comment1.target=MenuWorld()
comment10.params=
comment10.target=void\ act()
comment2.params=
comment2.target=void\ pfeilA()
comment3.params=
comment3.target=void\ pfeilB()
comment4.params=
comment4.target=void\ pfeilC()
comment5.params=
comment5.target=void\ pfeil1()
comment6.params=
comment6.target=void\ pfeil2()
comment7.params=
comment7.target=void\ pfeil3()
comment8.params=
comment8.target=void\ SpielerWahl1()
comment9.params=
comment9.target=void\ SpielerWahl2()
numComments=11
+133
View File
@@ -0,0 +1,133 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class StartWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MenuWorld extends World
{
/**
* Constructor for objects of class StartWorld.
*
*/
public int aktuellerSpieler1;
public int aktuellerSpieler2;
public Pfeil cursor1;
public Pfeil cursor2;
long timer;
long x;
Picture p4;
public MenuWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
showText("Anime Fighter" , 300, 50);
showText("select", 300, 103);
//showText("press enter to start", 300, 340);
showText("player 1 :", 130,100);
showText("player 2 :", 470,100);
showText("1 Ren ", 470,170);
showText("2 Tetsu ", 470,233);
showText("3 Hinata ", 470,296);
showText("a Ren ", 180,170);
showText("b Tetsu ", 180,233);
showText("c Hinata ", 180,296);
cursor1 = new Pfeil();
cursor1.setImage("IMG_7887.png");
GreenfootImage image = cursor1.getImage();
image.scale(220,70);
cursor1.setImage(image);
cursor1.getImage().mirrorHorizontally();
cursor2 = new Pfeil();
cursor2.setImage("IMG_7886.png");
GreenfootImage image2 = cursor2.getImage();
image2.scale(220,70);
cursor2.setImage(image2);
setBackground(new GreenfootImage("MenuScreen.png"));
setPaintOrder(Pfeil.class);
}
public void pfeilA(){
if(Greenfoot.isKeyDown("a")){
aktuellerSpieler1 = 1;
addObject(cursor1, 200, 100);
cursor1.setLocation(150,170);
}
}
public void pfeilB(){
if(Greenfoot.isKeyDown("b")){
aktuellerSpieler1 = 2;
addObject(cursor1, 200, 100);
cursor1.setLocation(150,232);
}
}
public void pfeilC(){
if(Greenfoot.isKeyDown("c")){
aktuellerSpieler1 = 3;
addObject(cursor1, 200, 100);
cursor1.setLocation(150,298);
}
}
public void pfeil1(){
if(Greenfoot.isKeyDown("1")){
aktuellerSpieler2 = 1;
addObject(cursor2, 200, 100);
cursor2.setLocation(446,170);
}
}
public void pfeil2(){
if(Greenfoot.isKeyDown("2")){
aktuellerSpieler2 = 2;
addObject(cursor2, 200, 0);
cursor2.setLocation(446,232);
}
}
public void pfeil3(){
if(Greenfoot.isKeyDown("3")){
aktuellerSpieler2 = 3;
addObject(cursor2, 200, 100);
cursor2.setLocation(446,298);
}
}
public void SpielerWahl1(){
pfeilA();
pfeilB();
pfeilC();
}
public void SpielerWahl2(){
pfeil1();
pfeil2();
pfeil3();
}
public void act(){
SpielerWahl1();
SpielerWahl2();
if (Greenfoot.isKeyDown("enter")){
if(aktuellerSpieler1 > 0 && aktuellerSpieler2 > 0){
Greenfoot.setWorld(new MyWorld(aktuellerSpieler1, aktuellerSpieler2));
}
}
if(System.currentTimeMillis() >= timer && aktuellerSpieler1 > 0 && aktuellerSpieler2 > 0){
p4 = new Picture(4);
addObject(p4,300,370);
x = System.currentTimeMillis() + 500;
timer = System.currentTimeMillis() + 1000;
}
if(System.currentTimeMillis() >= x){
removeObject(p4);
}
}
}
Binary file not shown.
+29 -3
View File
@@ -1,10 +1,36 @@
#BlueJ class context #BlueJ class context
comment0.target=MyWorld comment0.target=MyWorld
comment0.text=\r\n\ Write\ a\ description\ of\ class\ MyWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n comment0.text=\r\n\ Write\ a\ description\ of\ class\ MyWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params= comment1.params=pCharakterP1\ pCharakterP2
comment1.target=MyWorld() comment1.target=MyWorld(int,\ int)
comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ MyWorld.\r\n\ \r\n comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ MyWorld.\r\n\ \r\n
comment10.params=
comment10.target=void\ ultiP1()
comment11.params=
comment11.target=void\ ultiP2()
comment12.params=
comment12.target=void\ ultiAnimationP1()
comment13.params=
comment13.target=void\ ultiAnimationP2()
comment14.params=
comment14.target=void\ charakterP1()
comment15.params=
comment15.target=void\ charakterP2()
comment2.params= comment2.params=
comment2.target=void\ prepare() comment2.target=void\ prepare()
comment2.text=\r\n\ Prepare\ the\ world\ for\ the\ start\ of\ the\ program.\r\n\ That\ is\:\ create\ the\ initial\ objects\ and\ add\ them\ to\ the\ world.\r\n comment2.text=\r\n\ Prepare\ the\ world\ for\ the\ start\ of\ the\ program.\r\n\ That\ is\:\ create\ the\ initial\ objects\ and\ add\ them\ to\ the\ world.\r\n
numComments=3 comment3.params=
comment3.target=void\ act()
comment4.params=
comment4.target=void\ gameEnd()
comment5.params=
comment5.target=void\ lebensAnzeige()
comment6.params=
comment6.target=void\ shakra()
comment7.params=
comment7.target=void\ updateTimersP1()
comment8.params=
comment8.target=void\ shootP1()
comment9.params=
comment9.target=void\ shootP2()
numComments=16
+590 -3
View File
@@ -8,16 +8,50 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
*/ */
public class MyWorld extends World public class MyWorld extends World
{ {
Player1 player1;
Player2 player2;
int charakterP1;
int charakterP2;
Lebensanzeige l1;
Lebensanzeige l2;
Picture p1;
Picture p2;
int attack1Distance;
int attack2Distance;
int attack1Strength;
int attack2Strength;
int attack1DistanceP2;
int attack2DistanceP2;
int attack1StrengthP2;
int attack2StrengthP2;
int var;
Picture s1;
Picture s2;
String shootAnimation;
String shootAnimationP2;
String ultiAnimation;
String ultiAnimationP2;
String ultiAnimation2;
String ultiAnimation2P2;
Projectile projectile1;
Projectile2 projectile2;
boolean shot = false;
boolean shot2 = false;
boolean ulti = false;
boolean ulti2 = false;
/** /**
* Constructor for objects of class MyWorld. * Constructor for objects of class MyWorld.
* *
*/ */
public MyWorld() public MyWorld(int pCharakterP1, int pCharakterP2)
{ {
// Create a new world with 600x400 cells with a cell size of 1x1 pixels. // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1); super(600, 400, 1);
charakterP1 = pCharakterP1;
charakterP2 = pCharakterP2;
prepare(); prepare();
} }
/** /**
@@ -26,9 +60,562 @@ public class MyWorld extends World
*/ */
private void prepare() private void prepare()
{ {
player1 player1 = new player1(); player1 = new Player1(charakterP1);
addObject(player1,125,153); addObject(player1,125,153);
player2 player2 = new player2(); player2 = new Player2(charakterP2);
addObject(player2,429,152); addObject(player2,429,152);
l1 = new Lebensanzeige();
addObject(l1,150,40);
l2 = new Lebensanzeige();
addObject(l2,450,40);
p1 = new Picture(1);
addObject(p1,150,50);
p2 = new Picture(2);
addObject(p2,450,50);
s1 = new Picture(5);
addObject(s1,150,50);
s2 = new Picture(5);
addObject(s2,150,50);
charakterP1();
charakterP2();
}
public void act(){
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){
player2.leben = player2.leben -attack1Strength;
player1.shakra = player1.shakra +5;
if(player1.shakra > player1.maxShakra){
player1.shakra = player1.maxShakra;
}
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() &! player1.isBlocking){
if(player1.getX() - player2.getX() < attack1DistanceP2 && player1.getX() - player2.getX() > -attack1DistanceP2 && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player1.leben = player1.leben -attack1StrengthP2;
player2.shakra = player2.shakra +5;
if(player2.shakra > player2.maxShakra){
player2.shakra = player2.maxShakra;
}
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() &! player2.isBlocking){
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;
player1.shakra = player1.shakra +5;
if(player1.shakra > player1.maxShakra){
player1.shakra = player1.maxShakra;
}
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() &! player1.isBlocking){
if(player1.getX() - player2.getX() < attack2DistanceP2 && player1.getX() - player2.getX() > -attack2DistanceP2 && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player1.leben = player1.leben -attack2StrengthP2;
player2.shakra = player2.shakra +5;
if(player2.shakra > player2.maxShakra){
player2.shakra = player2.maxShakra;
}
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;
player1.shakra = player1.shakra +5;
if(player1.shakra > player1.maxShakra){
player1.shakra = player1.maxShakra;
}
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() < attack2DistanceP2 && player1.getX() - player2.getX() > -attack2DistanceP2 && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
player1.isBlocking = false;
player1.leben = player1.leben -attack2StrengthP2;
player2.shakra = player2.shakra +5;
if(player2.shakra > player2.maxShakra){
player2.shakra = player2.maxShakra;
}
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(player1.leben),150,40);
l1.leben(player1.leben, player1.maxLeben);
l2.leben(player2.leben, player2.maxLeben);
l1.setLocation(150 - (int)(100 - ((double)player1.leben/(double)player1.maxLeben)*100), 40);
l2.setLocation(450 + (int)(100 - ((double)player2.leben/(double)player2.maxLeben)*100), 40);
s1.setLocation(125 - (int)(60 - ((double)player1.shakra/(double)player1.maxShakra)*60),67);
s2.setLocation(475 + (int)(60 - ((double)player2.shakra/(double)player2.maxShakra)*60),67);
shakra();
gameEnd();
lebensAnzeige();
updateTimersP1();
if(player1.shootTimer == 30){
shootP1();
}
if(Greenfoot.isKeyDown("t")){
player1.isShooting = true;
}
if(player2.shootTimer == 30){
shootP2();
}
if(Greenfoot.isKeyDown("z")){
player2.isShooting = true;
}
if(shot){
if(projectile1.hit){
player2.leben = player2.leben -20;
player1.shakra = player1.shakra +5;
if(player1.shakra > player1.maxShakra){
player1.shakra = player1.maxShakra;
}
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;
shot = false;
}
}
if(shot2){
if(projectile2.hit){
player1.leben = player1.leben -20;
player2.shakra = player2.shakra +5;
if(player2.shakra > player2.maxShakra){
player2.shakra = player2.maxShakra;
}
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;
shot2 = false;
}
}
if(player1.ultiTimer == 30){
ultiP1();
}
if(Greenfoot.isKeyDown("g") && player1.shakra >= 30 && player1.isUlti == false){
player1.isUlti = true;
player1.shakra = player1.shakra-30;
}
if(player2.ultiTimer == 30){
ultiP2();
}
if(Greenfoot.isKeyDown("h") && player2.shakra >= 30 && player2.isUlti == false){
player2.isUlti = true;
player2.shakra = player2.shakra-30;
}
if(ulti){
if(projectile1.hit){
player2.leben = player2.leben -40;
player1.shakra = player1.shakra +5;
if(player1.shakra > player1.maxShakra){
player1.shakra = player1.maxShakra;
}
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;
ulti = false;
}
}
if(ulti2){
if(projectile2.hit){
player1.leben = player1.leben -40;
player2.shakra = player2.shakra +5;
if(player2.shakra > player2.maxShakra){
player2.shakra = player2.maxShakra;
}
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;
ulti2 = false;
}
}
ultiAnimationP1();
ultiAnimationP2();
}
public void gameEnd(){
if(player1.leben <= 0){
Greenfoot.setWorld(new EndWorld("Player Two"));
}
if(player2.leben <= 0){
Greenfoot.setWorld(new EndWorld("Player One"));
}
}
public void lebensAnzeige(){
}
public void shakra(){
if(player1.shakra > 0){
s1.setImage("blue.png");
GreenfootImage imag = s1.getImage();
imag.scale((int)(120 * ((double)player1.shakra/(double)player1.maxShakra)),5);
s1.setImage(imag);
}
else{
s1.setImage("blue.png");
GreenfootImage imag = s1.getImage();
imag.scale(1,1);
s1.setImage(imag);
}
if(player2.shakra > 0){
s2.setImage("blue.png");
GreenfootImage imag2 = s2.getImage();
imag2.scale((int)(120 * ((double)player2.shakra/(double)player2.maxShakra)),5);
s2.setImage(imag2);
}
else{
s2.setImage("blue.png");
GreenfootImage imag = s2.getImage();
imag.scale(1,1);
s2.setImage(imag);
}
}
protected void updateTimersP1()
{
if (player1.shootCooldown > 0) {
player1.shootCooldown--;
}
if (player2.shootCooldown > 0) {
player2.shootCooldown--;
}
if (player1.ultiCooldown > 0) {
player1.ultiCooldown--;
}
if (player2.ultiCooldown > 0) {
player2.ultiCooldown--;
}
}
public void shootP1()
{
if (player1.shootCooldown > 0) {
return;
}
int direction = player1.schautNachRechts ? 1 : -1;
projectile1 = new Projectile(direction, player1, player2);
projectile1.setImage(shootAnimation);
GreenfootImage image = projectile1.getImage();
image.scale(100, 100);
projectile1.setImage(image);
int spawnX = player1.getX() + direction * 60;
int spawnY = player1.getY() - 10;
addObject(projectile1, spawnX, spawnY);
shot = true;
player1.shootCooldown = 40;
}
public void shootP2()
{
if (player2.shootCooldown > 0) {
return;
}
int direction = player2.schautNachRechts ? 1 : -1;
projectile2 = new Projectile2(direction, player2, player1);
projectile2.setImage(shootAnimationP2);
GreenfootImage image = projectile2.getImage();
image.scale(100, 100);
projectile2.setImage(image);
int spawnX = player2.getX() + direction * 60;
int spawnY = player2.getY() - 10;
addObject(projectile2, spawnX, spawnY);
shot2 = true;
player2.shootCooldown = 40;
}
public void ultiP1()
{
if (player1.ultiCooldown > 0) {
return;
}
int direction = player1.schautNachRechts ? 1 : -1;
projectile1 = new Projectile(direction, player1, player2);
int spawnX = player1.getX() + direction * 60;
int spawnY = player1.getY() - 10;
addObject(projectile1, spawnX, spawnY);
ulti = true;
player1.ultiCooldown = 40;
}
public void ultiP2()
{
if (player2.ultiCooldown > 0) {
return;
}
int direction = player2.schautNachRechts ? 1 : -1;
projectile2 = new Projectile2(direction, player2, player1);
int spawnX = player2.getX() + direction * 60;
int spawnY = player2.getY() - 10;
addObject(projectile2, spawnX, spawnY);
ulti2 = true;
player2.ultiCooldown = 40;
}
public void ultiAnimationP1(){
if(player1.ultiCooldown > 35){
projectile1.setImage(ultiAnimation);
GreenfootImage image = projectile1.getImage();
image.scale(400, 400);
projectile1.setImage(image);
if(!player1.schautNachRechts){
projectile1.getImage().mirrorHorizontally();
}
}
if(player1.ultiCooldown > 0 && player1.ultiCooldown < 35){
projectile1.setImage(ultiAnimation2);
GreenfootImage image = projectile1.getImage();
image.scale(400, 400);
projectile1.setImage(image);
if(!player1.schautNachRechts){
projectile1.getImage().mirrorHorizontally();
}
}
}
public void ultiAnimationP2(){
if(player2.ultiCooldown > 35){
projectile2.setImage(ultiAnimationP2);
GreenfootImage image = projectile2.getImage();
image.scale(400, 400);
projectile2.setImage(image);
if(!player2.schautNachRechts){
projectile2.getImage().mirrorHorizontally();
}
}
if(player2.ultiCooldown > 0 && player2.ultiCooldown < 35){
projectile2.setImage(ultiAnimation2P2);
GreenfootImage image = projectile2.getImage();
image.scale(400, 400);
projectile2.setImage(image);
if(!player2.schautNachRechts){
projectile2.getImage().mirrorHorizontally();
}
}
}
public void charakterP1(){
if(charakterP1 == 1){
attack1Distance = 95;
attack2Distance = 120;
attack1Strength = 10;
attack2Strength = 20;
shootAnimation = "RenProjectile.png";
ultiAnimation = "RenUltiProjectile1.png";
ultiAnimation2 = "RenUltiProjectile2.png";
}
else if(charakterP1 == 2){
attack1Distance = 95;
attack2Distance = 145;
attack1Strength = 15;
attack2Strength = 30;
shootAnimation = "TetsuProjectile.png";
ultiAnimation = "TetsuUltiProjectile1.png";
ultiAnimation2 = "TetsuUltiProjectile2.png";
}
else if(charakterP1 == 3){
attack1Distance = 95;
attack2Distance = 110;
attack1Strength = 8;
attack2Strength = 15;
shootAnimation = "HinataProjectile.png";
ultiAnimation = "HinataUltiProjectile1.png";
ultiAnimation2 = "HinataUltiProjectile2.png";
}
}
public void charakterP2(){
if(charakterP2 == 1){
attack1DistanceP2 = 95;
attack2DistanceP2 = 120;
attack1StrengthP2 = 10;
attack2StrengthP2 = 20;
shootAnimationP2 = "RenProjectile.png";
ultiAnimationP2 = "RenUltiProjectile1.png";
ultiAnimation2P2 = "RenUltiProjectile2.png";
}
else if(charakterP2 == 2){
attack1DistanceP2 = 95;
attack2DistanceP2 = 145;
attack1StrengthP2 = 15;
attack2StrengthP2 = 30;
shootAnimationP2 = "TetsuProjectile.png";
ultiAnimationP2 = "TetsuUltiProjectile1.png";
ultiAnimation2P2 = "TetsuUltiProjectile2.png";
}
else if(charakterP2 == 3){
attack1DistanceP2 = 95;
attack2DistanceP2 = 110;
attack1StrengthP2 = 8;
attack2StrengthP2 = 15;
shootAnimationP2 = "HinataProjectile.png";
ultiAnimationP2 = "HinataUltiProjectile1.png";
ultiAnimation2P2 = "HinataUltiProjectile2.png";
}
} }
} }
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
#BlueJ class context
comment0.target=Picture
comment0.text=\r\n\ Write\ a\ description\ of\ class\ Picture\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params=pNumber
comment1.target=Picture(int)
comment2.params=
comment2.target=void\ act()
numComments=3
+50
View File
@@ -0,0 +1,50 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Picture here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Picture extends Actor
{
/**
* Act - do whatever the Picture wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int pictureNumber;
Picture(int pNumber){
pictureNumber = pNumber;
}
public void act()
{
if(pictureNumber == 1){
setImage("HealthbarLeft.png");
GreenfootImage image = getImage();
image.scale(230,53);
setImage(image);
}
if(pictureNumber == 2){
setImage("HealthbarRight.png");
GreenfootImage image = getImage();
image.scale(230,53);
setImage(image);
}
if(pictureNumber == 3){
setImage("press.png");
GreenfootImage image = getImage();
image.scale(400,133);
setImage(image);
}
if(pictureNumber == 4){
setImage("press.png");
GreenfootImage image = getImage();
image.scale(200,67);
setImage(image);
}
if(pictureNumber == 5){
}
}
}
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
#BlueJ class context
comment0.target=Projectile
comment1.params=direction\ pOwner\ pEnemy
comment1.target=Projectile(int,\ Player1,\ Player2)
comment2.params=
comment2.target=void\ act()
comment3.params=
comment3.target=void\ moveProjectile()
comment4.params=
comment4.target=void\ checkHit()
comment5.params=
comment5.target=void\ removeProjectile()
numComments=6
+67
View File
@@ -0,0 +1,67 @@
import greenfoot.*;
public class Projectile extends Actor
{
Player1 owner;
Player2 enemy;
int direction;
int speed = 8;
int damage = 10;
int lifetime = 100;
int currentFrame = 0;
int animationTimer = 0;
boolean isInWorld = true;
boolean hit = false;
public Projectile(int direction, Player1 pOwner, Player2 pEnemy)
{
this.direction = direction;
this.owner = pOwner;
enemy = pEnemy;
//Bilder für Schüsse nach links spiegeln
if (direction == -1) {
getImage().mirrorHorizontally();
}
}
public void act()
{
moveProjectile();
//animate();
checkHit();
lifetime--;
}
private void moveProjectile()
{
setLocation(getX() + speed * direction, getY());
}
private void checkHit()
{
if (getX() - enemy.getX() < 70 && getX() - enemy.getX() > -70 && getY() - enemy.getY() < 30 && getY() - enemy.getY() > -30 && isInWorld){
hit = true;
removeProjectile();
}
else if(lifetime <= 0 || isAtEdge()){
removeProjectile();
}
}
private void removeProjectile()
{
if (getWorld() != null) {
isInWorld = false;
getWorld().removeObject(this);
}
}
}
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
#BlueJ class context
comment0.target=Projectile2
comment1.params=direction\ pOwner\ pEnemy
comment1.target=Projectile2(int,\ Player2,\ Player1)
comment2.params=
comment2.target=void\ act()
comment3.params=
comment3.target=void\ moveProjectile()
comment4.params=
comment4.target=void\ checkHit()
comment5.params=
comment5.target=void\ removeProjectile()
numComments=6
+67
View File
@@ -0,0 +1,67 @@
import greenfoot.*;
public class Projectile2 extends Actor
{
Player2 owner;
Player1 enemy;
int direction;
int speed = 8;
int damage = 10;
int lifetime = 100;
int currentFrame = 0;
int animationTimer = 0;
boolean isInWorld = true;
boolean hit = false;
public Projectile2(int direction, Player2 pOwner, Player1 pEnemy)
{
this.direction = direction;
this.owner = pOwner;
enemy = pEnemy;
//Bilder für Schüsse nach links spiegeln
if (direction == -1) {
getImage().mirrorHorizontally();
}
}
public void act()
{
moveProjectile();
//animate();
checkHit();
lifetime--;
}
private void moveProjectile()
{
setLocation(getX() + speed * direction, getY());
}
private void checkHit()
{
if (getX() - enemy.getX() < 70 && getX() - enemy.getX() > -70 && getY() - enemy.getY() < 30 && getY() - enemy.getY() > -30 && isInWorld){
hit = true;
removeProjectile();
}
else if(lifetime <= 0 || isAtEdge()){
removeProjectile();
}
}
private void removeProjectile()
{
if (getWorld() != null) {
isInWorld = false;
getWorld().removeObject(this);
}
}
}
Binary file not shown.
+3 -18
View File
@@ -3,22 +3,7 @@ comment0.target=StartWorld
comment0.text=\r\n\ Write\ a\ description\ of\ class\ StartWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n comment0.text=\r\n\ Write\ a\ description\ of\ class\ StartWorld\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params= comment1.params=
comment1.target=StartWorld() comment1.target=StartWorld()
comment10.params= comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ StartWorld.\r\n\ \r\n
comment10.target=void\ act()
comment2.params= comment2.params=
comment2.target=void\ pfeilA() comment2.target=void\ act()
comment3.params= numComments=3
comment3.target=void\ pfeilB()
comment4.params=
comment4.target=void\ pfeilC()
comment5.params=
comment5.target=void\ pfeil1()
comment6.params=
comment6.target=void\ pfeil2()
comment7.params=
comment7.target=void\ pfeil3()
comment8.params=
comment8.target=void\ SpielerWahl1()
comment9.params=
comment9.target=void\ SpielerWahl2()
numComments=11
+13 -82
View File
@@ -8,101 +8,32 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
*/ */
public class StartWorld extends World public class StartWorld extends World
{ {
long x= 0;
long timer = 0;
Picture p3;
/** /**
* Constructor for objects of class StartWorld. * Constructor for objects of class StartWorld.
* *
*/ */
public int aktuellerSpieler1;
public int aktuellerSpieler2;
public Pfeil cursor1;
public Pfeil cursor2;
public StartWorld() public StartWorld()
{ {
// Create a new world with 600x400 cells with a cell size of 1x1 pixels. // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1); super(600, 400, 1);
showText("Spiel Name" , 300, 20);
showText("select a character", 300, 70);
showText("press enter to start", 300, 340);
showText("player 1 :", 100,100);
showText("player 2 :", 500,100);
showText("1 character 1", 500,150);
showText("2 character 2", 500,200);
showText("3 character 3", 500,250);
showText("a character 1", 100,150);
showText("b character 2", 100,200);
showText("c character 3", 100,250);
cursor1 = new Pfeil();
cursor1.setImage("cursor.png");
addObject(cursor1, 50, 160);
cursor2 = new Pfeil();
cursor2.setImage("cursor.png");
addObject(cursor2 , 450, 160);
}
public void pfeilA(){
if(Greenfoot.isKeyDown("a")){
aktuellerSpieler1 = 1;
cursor1.setLocation(50,160);
}
}
public void pfeilB(){
if(Greenfoot.isKeyDown("b")){
aktuellerSpieler1 = 2;
cursor1.setLocation(50,210);
}
}
public void pfeilC(){
if(Greenfoot.isKeyDown("c")){
aktuellerSpieler1 = 3;
cursor1.setLocation(50,260);
}
}
public void pfeil1(){
if(Greenfoot.isKeyDown("1")){
aktuellerSpieler2 = 1;
cursor2.setLocation(450,160);
}
}
public void pfeil2(){
if(Greenfoot.isKeyDown("2")){
aktuellerSpieler2 = 2;
cursor2.setLocation(450,210);
}
}
public void pfeil3(){
if(Greenfoot.isKeyDown("3")){
aktuellerSpieler2 = 3;
cursor2.setLocation(450,260);
}
}
public void SpielerWahl1(){
pfeilA();
pfeilB();
pfeilC();
}
public void SpielerWahl2(){
pfeil1();
pfeil2();
pfeil3();
} }
public void act(){ public void act(){
SpielerWahl1(); if(System.currentTimeMillis() >= timer){
SpielerWahl2(); p3 = new Picture(3);
if (Greenfoot.isKeyDown("enter")){ addObject(p3,300,350);
if(aktuellerSpieler1 > 0 && aktuellerSpieler2 > 0){ x = System.currentTimeMillis() + 500;
Greenfoot.setWorld(new MyWorld()); timer = System.currentTimeMillis() + 1000;
} }
if(System.currentTimeMillis() >= x){
removeObject(p3);
}
if (Greenfoot.isKeyDown("enter")){
Greenfoot.setWorld(new MenuWorld());
} }
} }
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

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: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 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: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Some files were not shown because too many files have changed in this diff Show More