aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/sowgro/npehero/gameplay/Block.java
blob: 5d35ccc082aa33d21c8363c2429bdd3a08cfe9b1 (plain) (blame)
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
//glowing block of color c (jfx node)

package net.sowgro.npehero.gameplay;

import javafx.scene.effect.BlurType;
import javafx.scene.effect.DropShadow;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import net.sowgro.npehero.levelapi.Note;

/**
 * A block is a visual representation of a note on the screen. This is used both in the editor and in during the game play.
 */
public class Block extends Rectangle
{
    public Color color;
    public Note note;

    public Block(Color color, boolean useDropShadow, Note note)
    {
        this.note = note;
        this.color = color;
       
        super.setFill(color);

        if (useDropShadow) {
            enableDropShadow();
        }
    }

    public Block(Color color, Note note) {
        this(color, true, note);
    }

    public void enableDropShadow() {
        DropShadow dropShadow = new DropShadow();
        dropShadow.setRadius(200.0);
        dropShadow.setColor(color);
        dropShadow.setBlurType(BlurType.GAUSSIAN);
        super.setEffect(dropShadow);
    }
}