-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcirculo.java
More file actions
68 lines (63 loc) · 1.65 KB
/
circulo.java
File metadata and controls
68 lines (63 loc) · 1.65 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class circulo here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class circulo extends Actor
{
/**
* Act - do whatever the circulo wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
GreenfootImage img;
int radio;
Game mundo;
Color miColor;
protected void addedToWorld(World w)
{
mundo=(Game)w;
}
public circulo(int rad)
{
radio=rad;
img=new GreenfootImage(radio*2,radio*2);
miColor=new Color(128,128,128);
img.setColor(miColor);
img.drawOval(0,0,radio*2,radio*2);
setImage(img);
}
public void cambiarColor(int r,int v,int a)
{
img.clear();
miColor=new Color(r,v,a);
img.setColor(miColor);
img.drawOval(0,0,radio*2,radio*2);
setImage(img);
}
public void redimensionar()
{
img=new GreenfootImage(radio*2,radio*2);
img.setColor(miColor);
img.drawOval(0,0,radio*2,radio*2);
setImage(img);
}
public void act()
{
radio--;
//if(radio==250)
//{
// mundo.addObject(mundo.rojo,400,300);
//mundo.addObject(new circulo(250),400,300);
//mundo.removeObject(this);
//return;
//}
if(radio==30)
{
getWorld().removeObject(this);
return;
}
redimensionar();
}
}