Source

fx-games / defender / src / main / resources / fxml / level / level-1.fxml

Full commit
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.*?>
<?import javafx.scene.shape.*?>
<?import com.fxexperience.games.defender.badguy.*?>
<?import com.fxexperience.games.defender.level.*?>

<Level xmlns:fx="http://javafx.com/fxml">

    <name>The First Level</name>

    <!-- Level background (could be anything but we just use a Rectangle for now) -->

    <children>
        <Rectangle width="800" height="600" fill="GHOSTWHITE"/>
    </children>

    <!-- Paths that BadGuys can take -->

    <fx:define>
        <Path fx:id="path1">
            <elements>
                <MoveTo x="-40" y="40"/>
                <CubicCurveTo controlX1="380" controlY1="0" controlX2="380" controlY2="120" x="200" y="120"/>
                <CubicCurveTo controlX1="0" controlY1="120" controlX2="0" controlY2="240" x="850" y="500"/>
            </elements>
        </Path>
        <Path fx:id="path2">
            <elements>
                <MoveTo x="20" y="-40"/>
                <CubicCurveTo controlX1="300" controlY1="0" controlX2="390" controlY2="160" x="270" y="120"/>
                <CubicCurveTo controlX1="0" controlY1="180" controlX2="0" controlY2="240" x="850" y="500"/>
            </elements>
        </Path>
    </fx:define>


    <!-- BadGuys -->

    <badGuys>

        <BadGuy path="$path1">
            <Rectangle width="20" height="20" fill="RED" arcWidth="6" arcHeight="6"/>
        </BadGuy>
        <BadGuy initialDelay="1s" path="$path1">
            <Rectangle width="20" height="20" fill="RED" arcWidth="6" arcHeight="6"/>
        </BadGuy>
        <BadGuy initialDelay="1500ms" path="$path2">
            <Rectangle width="20" height="20" fill="BLUE" arcWidth="6" arcHeight="6"/>
        </BadGuy>
        <BadGuy initialDelay="2s" path="$path1">
            <Rectangle width="20" height="20" fill="RED" arcWidth="6" arcHeight="6"/>
        </BadGuy>
        <BadGuy initialDelay="3s" path="$path1">
            <Rectangle width="20" height="20" fill="RED" arcWidth="6" arcHeight="6"/>
        </BadGuy>
        <BadGuy initialDelay="5s" path="$path2">
            <Rectangle width="20" height="20" fill="BLUE" arcWidth="6" arcHeight="6"/>
        </BadGuy>
        <BadGuy initialDelay="6s" path="$path1">
            <Rectangle width="20" height="20" fill="RED" arcWidth="6" arcHeight="6"/>
        </BadGuy>
        <BadGuy initialDelay="10s" path="$path1">
            <Rectangle width="20" height="20" fill="GREEN" arcWidth="6" arcHeight="6"/>
        </BadGuy>

    </badGuys>


    <!-- Areas where Towers can be layed -->

    <allowedTowerAreas>
        <Rectangle x="50" y="50" width="100" height="100" fill="GRAY"/>
        <Rectangle x="200" y="150" width="100" height="100" fill="GRAY"/>
    </allowedTowerAreas>


</Level>