Compare commits
16 Commits
testbranch
...
40867c7800
| Author | SHA1 | Date | |
|---|---|---|---|
| 40867c7800 | |||
| 0c0e0f39da | |||
| 988c8196f6 | |||
| 8f4f730c72 | |||
| 700eef1064 | |||
| 4d98573c7c | |||
| 067d36033d | |||
| 60d21d5f68 | |||
| cce1abcc81 | |||
| 6b842a7b75 | |||
| 67db7a5e48 | |||
| 6e7ff8d2eb | |||
| c4505df6ed | |||
| a53a0a22c6 | |||
| 48b3ce212f | |||
| 6301a9b0a6 |
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/fighter" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -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
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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 Fighters" , 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#BlueJ class context
|
||||
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
|
||||
comment1.params=pCharakterP1\ pCharakterP2
|
||||
comment1.target=MyWorld(int,\ int)
|
||||
comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ MyWorld.\r\n\ \r\n
|
||||
comment2.params=
|
||||
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
|
||||
comment3.params=
|
||||
comment3.target=void\ act()
|
||||
comment4.params=
|
||||
comment4.target=void\ gameEnd()
|
||||
comment5.params=
|
||||
comment5.target=void\ lebensAnzeige()
|
||||
comment6.params=
|
||||
comment6.target=void\ charakterP1()
|
||||
numComments=7
|
||||
@@ -0,0 +1,231 @@
|
||||
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
|
||||
/**
|
||||
* Write a description of class MyWorld here.
|
||||
*
|
||||
* @author (your name)
|
||||
* @version (a version number or a date)
|
||||
*/
|
||||
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 var;
|
||||
/**
|
||||
* Constructor for objects of class MyWorld.
|
||||
*
|
||||
*/
|
||||
public MyWorld(int pCharakterP1, int pCharakterP2)
|
||||
{
|
||||
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
|
||||
super(600, 400, 1);
|
||||
charakterP1 = pCharakterP1;
|
||||
charakterP2 = pCharakterP2;
|
||||
prepare();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the world for the start of the program.
|
||||
* That is: create the initial objects and add them to the world.
|
||||
*/
|
||||
private void prepare()
|
||||
{
|
||||
player1 = new Player1(charakterP1);
|
||||
addObject(player1,125,153);
|
||||
player2 = new Player2(charakterP2);
|
||||
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);
|
||||
charakterP1();
|
||||
}
|
||||
|
||||
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;
|
||||
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() < attack1Distance && player1.getX() - player2.getX() > -attack1Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
|
||||
player1.leben = player1.leben -attack1Strength;
|
||||
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;
|
||||
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() < attack2Distance && player1.getX() - player2.getX() > -attack2Distance && player1.getY() - player2.getY() < 30 && player1.getY() - player2.getY() > -30){
|
||||
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;
|
||||
}
|
||||
}
|
||||
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(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);
|
||||
gameEnd();
|
||||
lebensAnzeige();
|
||||
}
|
||||
|
||||
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 charakterP1(){
|
||||
if(charakterP1 == 1){
|
||||
attack1Distance = 95;
|
||||
attack2Distance = 120;
|
||||
attack1Strength = 10;
|
||||
attack2Strength = 20;
|
||||
}
|
||||
else if(charakterP1 == 2){
|
||||
attack1Distance = 95;
|
||||
attack2Distance = 145;
|
||||
attack1Strength = 15;
|
||||
attack2Strength = 30;
|
||||
}
|
||||
else if(charakterP1 == 3){
|
||||
attack1Distance = 95;
|
||||
attack2Distance = 110;
|
||||
attack1Strength = 8;
|
||||
attack2Strength = 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#BlueJ class context
|
||||
comment0.target=Pfeil
|
||||
comment0.text=\r\n\ Write\ a\ description\ of\ class\ Pfeil\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
|
||||
comment1.params=
|
||||
comment1.target=void\ act()
|
||||
comment1.text=\r\n\ Act\ -\ do\ whatever\ the\ Pfeil\ 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\ Pfeil()
|
||||
numComments=3
|
||||
@@ -0,0 +1,22 @@
|
||||
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
|
||||
/**
|
||||
* Write a description of class Pfeil here.
|
||||
*
|
||||
* @author (your name)
|
||||
* @version (a version number or a date)
|
||||
*/
|
||||
public class Pfeil extends Actor
|
||||
{
|
||||
/**
|
||||
* Act - do whatever the Pfeil wants to do. This method is called whenever
|
||||
* the 'Act' or 'Run' button gets pressed in the environment.
|
||||
*/
|
||||
public void act()
|
||||
{
|
||||
// Add your action code here.
|
||||
}
|
||||
public void Pfeil(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,47 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
------------------------------------------------------------------------
|
||||
This is the project README file. Here, you should describe your project.
|
||||
Tell the reader (someone who does not know anything about this project)
|
||||
all they need to know. The comments should usually include at least:
|
||||
------------------------------------------------------------------------
|
||||
|
||||
PROJECT TITLE:
|
||||
PURPOSE OF PROJECT:
|
||||
VERSION or DATE:
|
||||
HOW TO START THIS PROJECT:
|
||||
AUTHORS:
|
||||
USER INSTRUCTIONS:
|
||||
@@ -0,0 +1,9 @@
|
||||
#BlueJ class context
|
||||
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
|
||||
comment1.params=
|
||||
comment1.target=StartWorld()
|
||||
comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ StartWorld.\r\n\ \r\n
|
||||
comment2.params=
|
||||
comment2.target=void\ act()
|
||||
numComments=3
|
||||
@@ -0,0 +1,39 @@
|
||||
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 StartWorld extends World
|
||||
{
|
||||
long x= 0;
|
||||
long timer = 0;
|
||||
Picture p3;
|
||||
/**
|
||||
* Constructor for objects of class StartWorld.
|
||||
*
|
||||
*/
|
||||
public StartWorld()
|
||||
{
|
||||
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
|
||||
super(600, 400, 1);
|
||||
|
||||
}
|
||||
|
||||
public void act(){
|
||||
if(System.currentTimeMillis() >= timer){
|
||||
p3 = new Picture(3);
|
||||
addObject(p3,300,350);
|
||||
x = System.currentTimeMillis() + 500;
|
||||
timer = System.currentTimeMillis() + 1000;
|
||||
}
|
||||
if(System.currentTimeMillis() >= x){
|
||||
removeObject(p3);
|
||||
}
|
||||
if (Greenfoot.isKeyDown("enter")){
|
||||
Greenfoot.setWorld(new MenuWorld());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 3.1 MiB |
|
After Width: | Height: | Size: 122 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: 414 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 205 KiB |
|
After Width: | Height: | Size: 223 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 233 KiB |
|
After Width: | Height: | Size: 270 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
After Width: | Height: | Size: 291 KiB |
|
After Width: | Height: | Size: 128 KiB |
|
After Width: | Height: | Size: 152 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 102 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 131 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 205 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 168 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 147 KiB |
|
After Width: | Height: | Size: 469 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: 31 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
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: 439 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 198 KiB |
|
After Width: | Height: | Size: 153 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 108 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 116 KiB |