- Lebensanzeige
- walk Animation fertig
@@ -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,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
|
||||||
|
|||||||