ALLES
This commit is contained in:
+15
-84
@@ -8,101 +8,32 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
*/
|
||||
public class StartWorld extends World
|
||||
{
|
||||
|
||||
long x= 0;
|
||||
long timer = 0;
|
||||
Picture p3;
|
||||
/**
|
||||
* Constructor for objects of class StartWorld.
|
||||
*
|
||||
*/
|
||||
public int aktuellerSpieler1;
|
||||
public int aktuellerSpieler2;
|
||||
public Pfeil cursor1;
|
||||
public Pfeil cursor2;
|
||||
|
||||
public StartWorld()
|
||||
{
|
||||
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
|
||||
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, 100);
|
||||
|
||||
cursor2 = new Pfeil();
|
||||
cursor2.setImage("cursor.png");
|
||||
addObject(cursor2 , 450, 100);
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
super(600, 400, 1);
|
||||
|
||||
}
|
||||
|
||||
public void act(){
|
||||
SpielerWahl1();
|
||||
SpielerWahl2();
|
||||
if (Greenfoot.isKeyDown("enter")){
|
||||
if(aktuellerSpieler1 > 0 && aktuellerSpieler2 > 0){
|
||||
Greenfoot.setWorld(new MyWorld(aktuellerSpieler1, aktuellerSpieler2));
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user