Package res.elements

Source Code of res.elements.Thorn

/*
  PlAr is Platform Arena: a 2D multiplayer shooting game
  Copyright (c) 2010, Antonio Ragagnin <spocchio@gmail.com>
    All rights reserved.

    This file is licensed under the New BSD License.
*/

package res.elements;

import plar.core.Action;
import plar.core.ActionTouch;
import plar.core.Common;
import plar.core.Element;
import plar.core.Common.ElementType;
import plar.core.ElementGadget;
import plar.core.ElementPlayer;

public class Thorn extends  ElementGadget {
    public int damage;

    public Thorn() {
        super();
        isRunnable = true;
        this.setBoxShape(0.5f, 0.5f);
        damage=100;
        setTimer(false);
        spritechange=false;

    }

    public void elementCollided(Element e) {
        Common.info(1," This:"+this+ " Collided with"+e+"");
        if(e.type==Common.ElementType.PLAYER) {

            ElementPlayer p = ((ElementPlayer)e);
            ((ElementPlayer) e).lastTouch=null;
            p.energy-=damage;
        }

    }



}
TOP

Related Classes of res.elements.Thorn

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.