-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnake.java
More file actions
48 lines (42 loc) · 856 Bytes
/
Snake.java
File metadata and controls
48 lines (42 loc) · 856 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
36
37
38
39
40
41
42
43
44
45
46
47
48
import javafx.application.*;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.shape.*;
import javafx.util.Duration;
import java.util.ArrayList;
import javafx.animation.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
public class Snake {
public ArrayList<Ball> snake;
public int length;
public int speed;
public double x;
public double y;
public double direction;
public Snake(Pane root) {
snake = new ArrayList<Ball>();
this.length = 6;
this.speed = 3;
this.x=(root.getWidth())/2;
this.y=(root.getHeight())/2;
this.direction=0;
}
public int getlength()
{
return length;
}
public int getspeed()
{
return speed;
}
public double getx()
{
return x;
}
public double gety()
{
return y;
}
}