-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApuntes.java
38 lines (36 loc) · 1.2 KB
/
Apuntes.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Apuntes here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Apuntes extends Actor
{
int MOVE= 8;
/**
* Act - do whatever the Apuntes wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
setLocation(getX(), getY()-MOVE);
Enemigo3 e = (Enemigo3) getOneIntersectingObject(Enemigo3.class);
if(e!=null)
{
SalonClases3.vidaEnemigo.add(-1);
getWorld().removeObject(this);
SalonClases3.score.add(10);
if(SalonClases3.vidaEnemigo.getValue()==0){
GameRecord gameRecord = new GameRecord(Greenfoot.ask("Nombre del Jugador: "), SalonClases3.score.getValue() );
RecordsManager recordsManager = new RecordsManager("records.txt", 10);
recordsManager.save(gameRecord);
Greenfoot.setWorld(new ScoreWorld());
}
}
else if(getY() <5)
{
getWorld().removeObject(this);
}
}
}