/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Ocarina2D.Objects.Player;
import Ocarina2D.Objects.DekuNut;
import puppyeyes.engine.Sprite;
/**
*
* @author majora
*/
public class PlayerDekuNut extends PlayerReplace {
private String direction;
public PlayerDekuNut(String direction) {
super("Player Deku Nut");
System.out.println("CREATEDNUT");
this.direction = direction;
draw.getAnimation().frame = 0;
draw.getAnimation().setSpeed(0.2);
if (direction.equals("Up")) {
addFrame(new Sprite("Resources/Sprites/player/dekunut/dekuup0.png"));
addFrame(new Sprite("Resources/Sprites/player/dekunut/dekuup1.png"));
} else if (direction.equals("Down")) {
addFrame(new Sprite("Resources/Sprites/player/dekunut/dekudown0.png"));
addFrame(new Sprite("Resources/Sprites/player/dekunut/dekudown1.png"));
} else if (direction.equals("Left")) {
addFrame(new Sprite("Resources/Sprites/player/dekunut/dekuleft0.png"));
addFrame(new Sprite("Resources/Sprites/player/dekunut/dekuleft1.png"));
} else if (direction.equals("Right")) {
addFrame(new Sprite("Resources/Sprites/player/dekunut/dekuright0.png"));
addFrame(new Sprite("Resources/Sprites/player/dekunut/dekuright1.png"));
}
}
@Override
public void step() {
super.step();
if (draw.getCurrentFrame() >= 1.8) {
System.out.println("DESTROY");
DekuNut nut = new DekuNut();
if (direction.equals("Up")) {
nut.position.x = position.x+3;
nut.position.y = position.y-8;
} else if (direction.equals("Down")) {
nut.position.x = position.x+3;
nut.position.y = position.y+26;
} else if (direction.equals("Left")) {
nut.position.x = position.x-18;
nut.position.y = position.y+14;
} else if (direction.equals("Right")) {
nut.position.x = position.x+24;
nut.position.y = position.y+14;
}
this.destroy();
}
}
}