Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4d98573c7c | |||
| 067d36033d |
@@ -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
|
||||||
|
comment3.target=void\ leben(double)
|
||||||
|
numComments=4
|
||||||
@@ -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,40);
|
||||||
|
setImage(image);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void act()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void leben(double pLeben){
|
||||||
|
if(pLeben != 0){
|
||||||
|
setImage("green.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale((int)(200 * (pLeben/100)),40);
|
||||||
|
setImage(image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,4 +11,6 @@ comment3.params=
|
|||||||
comment3.target=void\ act()
|
comment3.target=void\ act()
|
||||||
comment4.params=
|
comment4.params=
|
||||||
comment4.target=void\ gameEnd()
|
comment4.target=void\ gameEnd()
|
||||||
numComments=5
|
comment5.params=
|
||||||
|
comment5.target=void\ lebensAnzeige()
|
||||||
|
numComments=6
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public class MyWorld extends World
|
|||||||
Player2 player2;
|
Player2 player2;
|
||||||
int charakterP1;
|
int charakterP1;
|
||||||
int charakterP2;
|
int charakterP2;
|
||||||
|
Lebensanzeige l1;
|
||||||
|
Lebensanzeige l2;
|
||||||
/**
|
/**
|
||||||
* Constructor for objects of class MyWorld.
|
* Constructor for objects of class MyWorld.
|
||||||
*
|
*
|
||||||
@@ -20,9 +22,10 @@ public class MyWorld extends World
|
|||||||
{
|
{
|
||||||
// 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);
|
||||||
prepare();
|
|
||||||
charakterP1 = pCharakterP1;
|
charakterP1 = pCharakterP1;
|
||||||
charakterP2 = pCharakterP2;
|
charakterP2 = pCharakterP2;
|
||||||
|
prepare();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,10 +34,14 @@ public class MyWorld extends World
|
|||||||
*/
|
*/
|
||||||
private void prepare()
|
private void prepare()
|
||||||
{
|
{
|
||||||
player1 = new Player1();
|
player1 = new Player1(charakterP1);
|
||||||
addObject(player1,125,153);
|
addObject(player1,125,153);
|
||||||
player2 = new Player2();
|
player2 = new Player2(charakterP2);
|
||||||
addObject(player2,429,152);
|
addObject(player2,429,152);
|
||||||
|
l1 = new Lebensanzeige();
|
||||||
|
addObject(l1,150,50);
|
||||||
|
l2 = new Lebensanzeige();
|
||||||
|
addObject(l2,450,50);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void act(){
|
public void act(){
|
||||||
@@ -48,7 +55,12 @@ public class MyWorld extends World
|
|||||||
player1.leben = player1.leben -10;
|
player1.leben = player1.leben -10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showText(String.valueOf(player2.leben),300,300);
|
showText(String.valueOf(player2.leben),450,50);
|
||||||
|
showText(String.valueOf(player1.leben),150,50);
|
||||||
|
l1.leben(player1.leben);
|
||||||
|
l2.leben(player2.leben);
|
||||||
|
l1.setLocation(150 - (100 - player1.leben), 50);
|
||||||
|
l2.setLocation(450 - (100 - player2.leben), 50);
|
||||||
gameEnd();
|
gameEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,4 +72,8 @@ public class MyWorld extends World
|
|||||||
Greenfoot.setWorld(new EndWorld("Player One"));
|
Greenfoot.setWorld(new EndWorld("Player One"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void lebensAnzeige(){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 119 KiB After Width: | Height: | Size: 131 KiB |
|
Before Width: | Height: | Size: 101 KiB After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 4.0 MiB |
|
After Width: | Height: | Size: 3.7 MiB |
|
After Width: | Height: | Size: 3.2 MiB |
|
After Width: | Height: | Size: 3.8 MiB |
|
After Width: | Height: | Size: 3.4 MiB |
|
After Width: | Height: | Size: 3.2 MiB |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 402 KiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 686 B |
|
After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 218 KiB |
|
After Width: | Height: | Size: 330 KiB |
|
After Width: | Height: | Size: 172 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 686 B |
@@ -1,8 +1,8 @@
|
|||||||
#BlueJ class context
|
#BlueJ class context
|
||||||
comment0.target=Player1
|
comment0.target=Player1
|
||||||
comment0.text=\r\n\ Write\ a\ description\ of\ class\ player\ 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\ player\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
|
||||||
comment1.params=
|
comment1.params=pCharakter
|
||||||
comment1.target=Player1()
|
comment1.target=Player1(int)
|
||||||
comment2.params=
|
comment2.params=
|
||||||
comment2.target=void\ act()
|
comment2.target=void\ act()
|
||||||
comment3.params=
|
comment3.params=
|
||||||
|
|||||||
@@ -22,8 +22,10 @@ public class Player1 extends Actor
|
|||||||
int laufPhase = 0;
|
int laufPhase = 0;
|
||||||
long laufTimer = 0;
|
long laufTimer = 0;
|
||||||
boolean laeuft = false;
|
boolean laeuft = false;
|
||||||
|
int charakter;
|
||||||
|
|
||||||
Player1(){
|
Player1(int pCharakter){
|
||||||
|
charakter = pCharakter;
|
||||||
leben = 100;
|
leben = 100;
|
||||||
schautNachRechts = true;
|
schautNachRechts = true;
|
||||||
charakter();
|
charakter();
|
||||||
@@ -54,11 +56,12 @@ public class Player1 extends Actor
|
|||||||
getImage().mirrorHorizontally();
|
getImage().mirrorHorizontally();
|
||||||
schautNachRechts = false;
|
schautNachRechts = false;
|
||||||
}
|
}
|
||||||
|
laeuft = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void springen(){
|
public void springen(){
|
||||||
if(Greenfoot.isKeyDown("space") && this.getY() > 363 ){
|
if(Greenfoot.isKeyDown("space") && this.getY() > 289 ){
|
||||||
for(int i = 12; i > -12; i--){
|
for(int i = 12; i > -12; i--){
|
||||||
setRotation(270);
|
setRotation(270);
|
||||||
move(i);
|
move(i);
|
||||||
@@ -77,15 +80,25 @@ public class Player1 extends Actor
|
|||||||
attacking = true;
|
attacking = true;
|
||||||
attackPhase = 1;
|
attackPhase = 1;
|
||||||
attackTimer = System.currentTimeMillis();
|
attackTimer = System.currentTimeMillis();
|
||||||
|
|
||||||
setImage("1Combo2.png");
|
if(schautNachRechts){
|
||||||
GreenfootImage image = getImage();
|
setImage("1Combo2.png");
|
||||||
image.scale(80, 80);
|
GreenfootImage image = getImage();
|
||||||
setImage(image);
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
setImage("1Combo2.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
c = System.currentTimeMillis() + 1000;
|
c = System.currentTimeMillis() + 500;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -98,14 +111,24 @@ public class Player1 extends Actor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void animation1(){
|
public void animation1(){
|
||||||
if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= 300) {
|
if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= 200) {
|
||||||
attackPhase = 2;
|
if(schautNachRechts){
|
||||||
setImage("2Combo1.png");
|
attackPhase = 2;
|
||||||
GreenfootImage image = getImage();
|
setImage("2Combo1.png");
|
||||||
image.scale(80, 80);
|
GreenfootImage image = getImage();
|
||||||
setImage(image);
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
attackPhase = 2;
|
||||||
|
setImage("2Combo1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (attacking && attackPhase == 2 && System.currentTimeMillis() - attackTimer >= 600) {
|
if (attacking && attackPhase == 2 && System.currentTimeMillis() - attackTimer >= 300) {
|
||||||
attacking = false;
|
attacking = false;
|
||||||
attackPhase = 0;
|
attackPhase = 0;
|
||||||
}
|
}
|
||||||
@@ -113,52 +136,102 @@ public class Player1 extends Actor
|
|||||||
|
|
||||||
public void anitmationLaufen(){
|
public void anitmationLaufen(){
|
||||||
if(laeuft){
|
if(laeuft){
|
||||||
|
if(schautNachRechts){
|
||||||
if(laufPhase == 0){
|
if(laufPhase == 0){
|
||||||
setImage("RenRun1.png");
|
setImage("RenRun1.png");
|
||||||
GreenfootImage image = getImage();
|
GreenfootImage image = getImage();
|
||||||
image.scale(80, 80);
|
image.scale(160, 160);
|
||||||
setImage(image);
|
setImage(image);
|
||||||
laufPhase = 1;
|
laufPhase = 1;
|
||||||
laufTimer = System.currentTimeMillis();
|
laufTimer = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 50){
|
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
setImage("RenRun2.png");
|
setImage("RenRun2.png");
|
||||||
GreenfootImage image = getImage();
|
GreenfootImage image = getImage();
|
||||||
image.scale(80, 80);
|
image.scale(160, 160);
|
||||||
setImage(image);
|
setImage(image);
|
||||||
laufPhase = 2;
|
laufPhase = 2;
|
||||||
laufTimer = System.currentTimeMillis();
|
laufTimer = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 50){
|
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
setImage("RenRun3.png");
|
setImage("RenRun3.png");
|
||||||
GreenfootImage image = getImage();
|
GreenfootImage image = getImage();
|
||||||
image.scale(80, 80);
|
image.scale(160, 160);
|
||||||
setImage(image);
|
setImage(image);
|
||||||
laufPhase = 3;
|
laufPhase = 3;
|
||||||
laufTimer = System.currentTimeMillis();
|
laufTimer = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 50){
|
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
setImage("RenRun4.png");
|
setImage("RenRun4.png");
|
||||||
GreenfootImage image = getImage();
|
GreenfootImage image = getImage();
|
||||||
image.scale(80, 80);
|
image.scale(160, 160);
|
||||||
setImage(image);
|
setImage(image);
|
||||||
laufPhase = 4;
|
laufPhase = 4;
|
||||||
laufTimer = System.currentTimeMillis();
|
laufTimer = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 50){
|
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
setImage("2Combo1.png");
|
setImage("2Combo1.png");
|
||||||
GreenfootImage image = getImage();
|
GreenfootImage image = getImage();
|
||||||
image.scale(80, 80);
|
image.scale(160, 160);
|
||||||
setImage(image);
|
setImage(image);
|
||||||
laufPhase = 0;
|
laufPhase = 0;
|
||||||
laufTimer = System.currentTimeMillis();
|
laufTimer = System.currentTimeMillis();
|
||||||
laeuft = false;
|
laeuft = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(laufPhase == 0){
|
||||||
|
setImage("RenRun1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 1;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun2.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 2;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun3.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 3;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun4.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 4;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("2Combo1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 0;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
laeuft = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gravitation(){
|
public void gravitation(){
|
||||||
if(this.getY() < 363){
|
if(this.getY() < 290){
|
||||||
setRotation(90);
|
setRotation(90);
|
||||||
move(4);
|
move(4);
|
||||||
setRotation(0);
|
setRotation(0);
|
||||||
@@ -167,9 +240,12 @@ public class Player1 extends Actor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void charakter(){
|
public void charakter(){
|
||||||
setImage("2Combo1.png");
|
if(charakter == 1){
|
||||||
GreenfootImage image = getImage();
|
setImage("2Combo1.png");
|
||||||
image.scale(80,80);
|
GreenfootImage image = getImage();
|
||||||
setImage(image);
|
image.scale(160,160);
|
||||||
|
setImage(image);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#BlueJ class context
|
#BlueJ class context
|
||||||
comment0.target=Player2
|
comment0.target=Player2
|
||||||
comment0.text=\r\n\ Write\ a\ description\ of\ class\ player\ 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\ player\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
|
||||||
comment1.params=
|
comment1.params=pCharakter
|
||||||
comment1.target=Player2()
|
comment1.target=Player2(int)
|
||||||
comment2.params=
|
comment2.params=
|
||||||
comment2.target=void\ act()
|
comment2.target=void\ act()
|
||||||
comment3.params=
|
comment3.params=
|
||||||
@@ -12,5 +12,11 @@ comment4.target=void\ springen()
|
|||||||
comment5.params=
|
comment5.params=
|
||||||
comment5.target=boolean\ attacke()
|
comment5.target=boolean\ attacke()
|
||||||
comment6.params=
|
comment6.params=
|
||||||
comment6.target=void\ gravitation()
|
comment6.target=void\ animation1()
|
||||||
numComments=7
|
comment7.params=
|
||||||
|
comment7.target=void\ anitmationLaufen()
|
||||||
|
comment8.params=
|
||||||
|
comment8.target=void\ gravitation()
|
||||||
|
comment9.params=
|
||||||
|
comment9.target=void\ charakter()
|
||||||
|
numComments=10
|
||||||
|
|||||||
@@ -15,30 +15,53 @@ public class Player2 extends Actor
|
|||||||
|
|
||||||
public int leben;
|
public int leben;
|
||||||
long c;
|
long c;
|
||||||
|
boolean schautNachRechts;
|
||||||
|
long attackTimer = 0;
|
||||||
|
int attackPhase = 0;
|
||||||
|
boolean attacking = false;
|
||||||
|
int laufPhase = 0;
|
||||||
|
long laufTimer = 0;
|
||||||
|
boolean laeuft = false;
|
||||||
|
int charakter;
|
||||||
|
|
||||||
Player2(){
|
Player2(int pCharakter){
|
||||||
|
charakter = pCharakter;
|
||||||
leben = 100;
|
leben = 100;
|
||||||
|
schautNachRechts = false;
|
||||||
|
charakter();
|
||||||
}
|
}
|
||||||
public void act()
|
public void act()
|
||||||
{
|
{
|
||||||
bewegung();
|
bewegung();
|
||||||
gravitation();
|
gravitation();
|
||||||
springen();
|
springen();
|
||||||
|
animation1();
|
||||||
|
anitmationLaufen();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bewegung(){
|
public void bewegung(){
|
||||||
if(Greenfoot.isKeyDown("right")){
|
if(Greenfoot.isKeyDown("right")){
|
||||||
setRotation(0);
|
setRotation(0);
|
||||||
move(3);
|
move(5);
|
||||||
|
if(!schautNachRechts && attackPhase == 0){
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
schautNachRechts = true;
|
||||||
|
}
|
||||||
|
laeuft = true;
|
||||||
}
|
}
|
||||||
if(Greenfoot.isKeyDown("left")){
|
if(Greenfoot.isKeyDown("left")){
|
||||||
setRotation(0);
|
setRotation(0);
|
||||||
move(-3);
|
move(-5);
|
||||||
|
if(schautNachRechts && attackPhase == 0){
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
schautNachRechts = false;
|
||||||
|
}
|
||||||
|
laeuft = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void springen(){
|
public void springen(){
|
||||||
if(Greenfoot.isKeyDown("-") && this.getY() > 370 ){
|
if(Greenfoot.isKeyDown("up") && this.getY() > 289 ){
|
||||||
for(int i = 12; i > -12; i--){
|
for(int i = 12; i > -12; i--){
|
||||||
setRotation(270);
|
setRotation(270);
|
||||||
move(i);
|
move(i);
|
||||||
@@ -50,9 +73,31 @@ public class Player2 extends Actor
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean attacke(){
|
public boolean attacke(){
|
||||||
if(Greenfoot.isKeyDown("e")){
|
if(Greenfoot.isKeyDown(".")){
|
||||||
if(System.currentTimeMillis() >= c){
|
if(System.currentTimeMillis() >= c){
|
||||||
c = System.currentTimeMillis() + 2000;
|
|
||||||
|
if (!attacking) {
|
||||||
|
attacking = true;
|
||||||
|
attackPhase = 1;
|
||||||
|
attackTimer = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if(schautNachRechts){
|
||||||
|
setImage("1Combo2.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
setImage("1Combo2.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
c = System.currentTimeMillis() + 500;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -64,12 +109,143 @@ public class Player2 extends Actor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void animation1(){
|
||||||
|
if (attacking && attackPhase == 1 && System.currentTimeMillis() - attackTimer >= 200) {
|
||||||
|
if(schautNachRechts){
|
||||||
|
attackPhase = 2;
|
||||||
|
setImage("2Combo1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
attackPhase = 2;
|
||||||
|
setImage("2Combo1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (attacking && attackPhase == 2 && System.currentTimeMillis() - attackTimer >= 300) {
|
||||||
|
attacking = false;
|
||||||
|
attackPhase = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void anitmationLaufen(){
|
||||||
|
if(laeuft){
|
||||||
|
if(schautNachRechts){
|
||||||
|
if(laufPhase == 0){
|
||||||
|
setImage("RenRun1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
laufPhase = 1;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun2.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
laufPhase = 2;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun3.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
laufPhase = 3;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun4.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
laufPhase = 4;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("2Combo1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
laufPhase = 0;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
laeuft = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if(laufPhase == 0){
|
||||||
|
setImage("RenRun1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 1;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 1 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun2.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 2;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 2 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun3.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 3;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 3 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("RenRun4.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 4;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
if(laufPhase == 4 && System.currentTimeMillis() - laufTimer >= 100){
|
||||||
|
setImage("2Combo1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160, 160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
laufPhase = 0;
|
||||||
|
laufTimer = System.currentTimeMillis();
|
||||||
|
laeuft = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void gravitation(){
|
public void gravitation(){
|
||||||
if(this.getY() < 370){
|
if(this.getY() < 290){
|
||||||
setRotation(90);
|
setRotation(90);
|
||||||
move(4);
|
move(4);
|
||||||
setRotation(0);
|
setRotation(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void charakter(){
|
||||||
|
if(charakter == 1){
|
||||||
|
setImage("2Combo1.png");
|
||||||
|
GreenfootImage image = getImage();
|
||||||
|
image.scale(160,160);
|
||||||
|
setImage(image);
|
||||||
|
getImage().mirrorHorizontally();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,36 @@
|
|||||||
#Greenfoot project file
|
#Greenfoot project file
|
||||||
class.MyWorld.image=crumpled-paper.jpg
|
class.Lebensanzeige.image=Lebensanzeige.png
|
||||||
|
class.MyWorld.image=IMG_7841.png
|
||||||
class.Player1.image=man01.png
|
class.Player1.image=man01.png
|
||||||
class.Player2.image=man01.png
|
class.Player2.image=man01.png
|
||||||
dependency1.from=StartWorld
|
dependency1.from=EndWorld
|
||||||
dependency1.to=Pfeil
|
dependency1.to=StartWorld
|
||||||
dependency1.type=UsesDependency
|
dependency1.type=UsesDependency
|
||||||
dependency2.from=StartWorld
|
dependency2.from=StartWorld
|
||||||
dependency2.to=MyWorld
|
dependency2.to=Pfeil
|
||||||
dependency2.type=UsesDependency
|
dependency2.type=UsesDependency
|
||||||
dependency3.from=MyWorld
|
dependency3.from=StartWorld
|
||||||
dependency3.to=Player1
|
dependency3.to=MyWorld
|
||||||
dependency3.type=UsesDependency
|
dependency3.type=UsesDependency
|
||||||
dependency4.from=MyWorld
|
dependency4.from=MyWorld
|
||||||
dependency4.to=Player2
|
dependency4.to=Player1
|
||||||
dependency4.type=UsesDependency
|
dependency4.type=UsesDependency
|
||||||
editor.fx.0.height=737
|
dependency5.from=MyWorld
|
||||||
editor.fx.0.width=814
|
dependency5.to=Player2
|
||||||
editor.fx.0.x=168
|
dependency5.type=UsesDependency
|
||||||
editor.fx.0.y=39
|
dependency6.from=MyWorld
|
||||||
|
dependency6.to=Lebensanzeige
|
||||||
|
dependency6.type=UsesDependency
|
||||||
|
dependency7.from=MyWorld
|
||||||
|
dependency7.to=EndWorld
|
||||||
|
dependency7.type=UsesDependency
|
||||||
|
editor.fx.0.height=686
|
||||||
|
editor.fx.0.width=1294
|
||||||
|
editor.fx.0.x=-7
|
||||||
|
editor.fx.0.y=-7
|
||||||
height=686
|
height=686
|
||||||
package.numDependencies=4
|
package.numDependencies=7
|
||||||
package.numTargets=5
|
package.numTargets=7
|
||||||
project.charset=UTF-8
|
project.charset=UTF-8
|
||||||
publish.hasSource=false
|
publish.hasSource=false
|
||||||
publish.locked=true
|
publish.locked=true
|
||||||
@@ -43,33 +53,47 @@ target1.width=120
|
|||||||
target1.x=0
|
target1.x=0
|
||||||
target1.y=0
|
target1.y=0
|
||||||
target2.height=70
|
target2.height=70
|
||||||
target2.name=StartWorld
|
target2.name=EndWorld
|
||||||
target2.showInterface=false
|
target2.showInterface=false
|
||||||
target2.type=ClassTarget
|
target2.type=ClassTarget
|
||||||
target2.width=120
|
target2.width=120
|
||||||
target2.x=0
|
target2.x=0
|
||||||
target2.y=0
|
target2.y=0
|
||||||
target3.height=70
|
target3.height=70
|
||||||
target3.name=Player2
|
target3.name=Lebensanzeige
|
||||||
target3.showInterface=false
|
target3.showInterface=false
|
||||||
target3.type=ClassTarget
|
target3.type=ClassTarget
|
||||||
target3.width=120
|
target3.width=120
|
||||||
target3.x=0
|
target3.x=0
|
||||||
target3.y=0
|
target3.y=0
|
||||||
target4.height=70
|
target4.height=70
|
||||||
target4.name=Player1
|
target4.name=StartWorld
|
||||||
target4.showInterface=false
|
target4.showInterface=false
|
||||||
target4.type=ClassTarget
|
target4.type=ClassTarget
|
||||||
target4.width=120
|
target4.width=120
|
||||||
target4.x=0
|
target4.x=0
|
||||||
target4.y=0
|
target4.y=0
|
||||||
target5.height=70
|
target5.height=70
|
||||||
target5.name=MyWorld
|
target5.name=Player2
|
||||||
target5.showInterface=false
|
target5.showInterface=false
|
||||||
target5.type=ClassTarget
|
target5.type=ClassTarget
|
||||||
target5.width=120
|
target5.width=120
|
||||||
target5.x=0
|
target5.x=0
|
||||||
target5.y=0
|
target5.y=0
|
||||||
|
target6.height=70
|
||||||
|
target6.name=Player1
|
||||||
|
target6.showInterface=false
|
||||||
|
target6.type=ClassTarget
|
||||||
|
target6.width=120
|
||||||
|
target6.x=0
|
||||||
|
target6.y=0
|
||||||
|
target7.height=70
|
||||||
|
target7.name=MyWorld
|
||||||
|
target7.showInterface=false
|
||||||
|
target7.type=ClassTarget
|
||||||
|
target7.width=120
|
||||||
|
target7.x=0
|
||||||
|
target7.y=0
|
||||||
version=3.1.0
|
version=3.1.0
|
||||||
width=1294
|
width=1294
|
||||||
world.lastInstantiated=StartWorld
|
world.lastInstantiated=StartWorld
|
||||||
|
|||||||