-
Notifications
You must be signed in to change notification settings - Fork 6
/
Florest.java
executable file
·80 lines (68 loc) · 2.56 KB
/
Florest.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
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
69
70
71
72
73
74
75
76
77
78
79
80
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MyWorld here.
*
* @author (João Paulo S. Abreu (joaoabreu@ufba.br), Mateus C. Moura
* (mateuschaves@ufba.br), Rafael P. Casaes Sampaio
* (rafael.casaes@ufba.br),
* Uanderson S. Celestino (uandersoncelestino@ufba.br), Lílian T. de
* Sousa (lilian.sousa@ufba.br), Jefferson Aimon de B. Silva
* (jefferson.raimon@ufba.br))
* * @version (a version number or a date)
*/
public class Florest extends World {
/**
* Constructor for objects of class MyWorld.
*
*/
public Florest() {
// Create a new world with 700x500 cells with a cell size of 1x1 pixels.
// classe construtora de Florest
super(700, 500, 1);
addObject(new Score(), 25, 476);
addObject(new Parrot(), 151, 196);
setBackground("images/Fdia.png");
playloop();
}
public void act() {
// metodo atualiza as açoes do jogo, instanciando as classes
if (Greenfoot.getRandomNumber(500) < 1) {
addObject(new Fire(), 637, 331);
addObject(new Vulture(), 570, 15);
addObject(new Mushroom(), 470, 47);
}
if (Greenfoot.getRandomNumber(200) < 1) {
addObject(new Cloud(), 536, Greenfoot.getRandomNumber(91));
}
if (Greenfoot.getRandomNumber(600) < 1) {
addObject(new Fire(), 606, 445);
addObject(new Mushroom(), 250, 47);
addObject(new Vulture(), 552, Greenfoot.getRandomNumber(91));
}
if (Greenfoot.getRandomNumber(700) < 2) {
addObject(new Fire(), 615, 400);
addObject(new Vulture(), 552, Greenfoot.getRandomNumber(90));
}
if (Greenfoot.getRandomNumber(700) < 1) {
addObject(new Vulture(), 552, Greenfoot.getRandomNumber(95));
}
if (Greenfoot.getRandomNumber(200) < 1) {
addObject(new Vulture(), 665, Greenfoot.getRandomNumber(189));
}
}
//tocar trilha sonora
public void playloop() {
Greenfoot.playSound("sounds/theme.mp3");
}
public void gameOver() {
// metodo pra chamar a classe GameOver
addObject(new GameOver("Game Over!"), getWidth() / 2, getHeight() / 2);
Greenfoot.playSound("sounds/end.wav");
Greenfoot.stop();
Score.removePonto();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
}