<?xml version="1.0" encoding="UTF-8"?>
<class name="Imp2" extends="Zwerg" extends-java="Zwerg" enable="true" strideversion="1">
    <javadoc xml:space="preserve"/>
    <imports>
        <import target="java.util.*" enable="true"/>
        <import target="greenfoot.*" enable="true"/>
    </imports>
    <implements/>
    <fields>
        <variable access="private" type="int" type-java="int" name="speed" value="Greenfoot.getRandomNumber(3)+1" value-java="Greenfoot.getRandomNumber(3) + 1" enable="true"/>
    </fields>
    <constructors>
        <constructor access="public" enable="true">
            <javadoc xml:space="preserve"/>
            <params/>
            <throws/>
            <body>
                <call expression="this.setRotation(Greenfoot.getRandomNumber(360))" expression-java="this.setRotation(Greenfoot.getRandomNumber(360))" enable="true"/>
            </body>
        </constructor>
    </constructors>
    <methods>
        <method access="public" type="void" type-java="void" name="act" enable="true">
            <javadoc xml:space="preserve">Act - do whatever the Imp2 wants to do. This method is called whenever the 'Act' or 'Run' button gets pressed in the environment.</javadoc>
            <params/>
            <throws/>
            <body>
                <call expression="this.move(this.speed)" expression-java="this.move(this.speed)" enable="true"/>
                <if condition="this.isAtEdge()" condition-java="this.isAtEdge()" enable="true">
                    <ifStatements>
                        <call expression="this.turn(90)" expression-java="this.turn(90)" enable="true"/>
                    </ifStatements>
                </if>
                <if condition="this.isTouching(Prinzessin.class)" condition-java="this.isTouching(Prinzessin.class)" enable="true">
                    <ifStatements>
                        <variable type="Prinzessin" type-java="Prinzessin" name="prinzessin" value="(Prinzessin)this.getOneIntersectingObject(Prinzessin.class)" value-java="(Prinzessin)this.getOneIntersectingObject(Prinzessin.class)" enable="true"/>
                        <variable type="int" type-java="int" name="credit" value="(Greenfoot.getRandomNumber(10)+1)*100" value-java="(Greenfoot.getRandomNumber(10) + 1) * 100" enable="true"/>
                        <call expression="prinzessin.setCredit(prinzessin.getCredit()+credit)" expression-java="prinzessin.setCredit(prinzessin.getCredit() + credit)" enable="true"/>
                        <call expression="Message.showDialog(&quot;Zwerg gefangen! Sie erhalten &quot;+credit+&quot;$ und haben jetzt &quot;+prinzessin.getCredit()+&quot;$&quot;,&quot;Kontostand aufgestockt!&quot;)" expression-java="Message.showDialog(&quot;Zwerg gefangen! Sie erhalten &quot; + credit + &quot;$ und haben jetzt &quot; + prinzessin.getCredit() + &quot;$&quot;, &quot;Kontostand aufgestockt!&quot;)" enable="true"/>
                        <call expression="this.getWorld().removeObject(this)" expression-java="this.getWorld().removeObject(this)" enable="true"/>
                    </ifStatements>
                </if>
            </body>
        </method>
    </methods>
</class>
