-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLaser.java
More file actions
35 lines (30 loc) · 768 Bytes
/
Copy pathLaser.java
File metadata and controls
35 lines (30 loc) · 768 Bytes
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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Laser here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Laser extends Actor
{
public Laser(int rotation) {
setRotation(rotation);
}
public Laser() {
setRotation(270);
}
/**
* Act - do whatever the Laser wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int dy = 30;
public void act()
{
// Add your action code here.
// setLocation(getX(), getY() - dy);
move(dy);
if(isAtEdge()){
getWorld().removeObject(this);
}
}
}