- Spieler Attacke, Animation

This commit is contained in:
Max
2026-09-15 19:13:35 +02:00
parent a53a0a22c6
commit 6e7ff8d2eb
23 changed files with 212 additions and 68 deletions
+23 -1
View File
@@ -6,12 +6,19 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
* @author (your name)
* @version (a version number or a date)
*/
public class player2 extends Actor
public class Player2 extends Actor
{
/**
* Act - do whatever the player wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public int leben;
long c;
Player2(){
leben = 100;
}
public void act()
{
bewegung();
@@ -42,6 +49,21 @@ public class player2 extends Actor
}
}
public boolean attacke(){
if(Greenfoot.isKeyDown("e")){
if(System.currentTimeMillis() >= c){
c = System.currentTimeMillis() + 2000;
return true;
}
else{
return false;
}
}
else{
return false;
}
}
public void gravitation(){
if(this.getY() < 370){
setRotation(90);