Class ItemAsteroid

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class ItemAsteroid
    extends Item
    Asteroid that moves 1 point left each round. If a figure destroys an Asteroid, it gains 50.000 points and 100 money.
    See Also:
    Serialized Form
    • Constructor Detail

      • ItemAsteroid

        public ItemAsteroid()
        Creates a new Rocketeer figure on the field.
    • Method Detail

      • addStateProperties

        protected void addStateProperties​(ThingState state,
                                          AnimationInfo animation)
        Adds properties necessary for asteroid painting.
        Overrides:
        addStateProperties in class Thing
        Parameters:
        state - The state to add properties to.
        animation - The current AnimationInfo.
      • getPainterClassname

        public java.lang.String getPainterClassname()
        Gets the fully qualified classname of the Painter to use for this item (in 2D game).
        Overrides:
        getPainterClassname in class Item
        Returns:
        "com.starpoints.painter.arena2D.PainterItemAsteroid"
      • getItemRating

        public int getItemRating()
        Returns an item value for ComputerFigures rating in the items category.
        Overrides:
        getItemRating in class Item
        Returns:
        energy * -100.
      • isAvailableInEditor

        public boolean isAvailableInEditor()
        Checks, if this item is available in level editor.
        Overrides:
        isAvailableInEditor in class Item
        Returns:
        false.
      • performFieldEffect

        protected void performFieldEffect​(AnimationInfo animation)
        This method is called at the end of the regular updateThing()-method. If the number of rounds equal to the fire frequency has passed, since the last item rocket was used, the ItemRocketeer gains a new rocket of the type depending on this ItemRocketeers item nr setting and fires it.
        Overrides:
        performFieldEffect in class Item
        Parameters:
        animation - The AnimationInfo.
      • onBeforeDie

        protected void onBeforeDie​(Thing source,
                                   DieReason reason,
                                   AnimationInfo animation)
        Called, before the item dies. Gives the source 50000 points and 100 money.
        Overrides:
        onBeforeDie in class Item
        Parameters:
        source - The death source. Might be null if dying e.g. because of energy losses by gray points.
        reason - The death reason.
        animation - The AnimationInfo.
      • onBePickedUp

        public boolean onBePickedUp​(Figure picker,
                                    AnimationInfo animation)
        Teleports away.
        Overrides:
        onBePickedUp in class Item
        Parameters:
        picker - The picker
        animation - The AnimationInfo.
        Returns:
        false
      • onHitItem

        public boolean onHitItem​(Item rammedItem,
                                 AnimationInfo animation)
        Method called if this item moves and hits another item.
        Overrides:
        onHitItem in class Item
        Parameters:
        rammedItem - The rammed item
        animation - The AnimationInfo.
        Returns:
        true, if this item is placed on the rammed items point. True by default.
      • getImageName

        public java.lang.String getImageName​(AnimationInfo animation)
        Returns image name.
        Overrides:
        getImageName in class Thing
        Parameters:
        animation - The AnimationInfo.
        Returns:
        "item_mystery"+imageCount
      • getMoveAnimationLength

        public int getMoveAnimationLength()
        Method that can be overwritten by moving item subclasses, in case move animation should not last for default of 3 update cycles.
        Overrides:
        getMoveAnimationLength in class Item
        Returns:
        3 by default.
      • isRocketTarget

        public boolean isRocketTarget()
        Checks, if this item is a rocket target.
        Overrides:
        isRocketTarget in class Item
        Returns:
        false as default.