My Project
 Todo Clases Archivos Funciones Variables
Policia.java
Ir a la documentación de este archivo.
1 import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
2 
9 public class Policia extends Enemigo
10 {
15  public Policia(int valor)
16  {
17  ubic = valor;
18  img = new GreenfootImage("poli.png");
19  img.scale(120,120);
20  if(ubic == 0)
21  setImage(img);
22  else
23  {
24  img.mirrorVertically();
25  setImage(img);
26  }
27  }
28 
32  public void act()
33  {
34  setImage(img);
35  super.mueve();
36  remueveimagen();
37  }
38 
42  public void intersecta()
43  {
44  Actor otro;
45  otro = getOneIntersectingObject(Personaje.class);
46  if(otro != null)
47  {
48  ((Mundo)getWorld()).mandaPolicia(ubic);
49  }
50  }
51 
55  public void remueveimagen()
56  {
57  if(this.getX() == 0)
58  getWorld().removeObject(this);
59  }
60 }