56 lines
1.3 KiB
ActionScript
56 lines
1.3 KiB
ActionScript
package com.arc.dh.objects
|
|
{
|
|
import com.arc.dh.entities.Entity;
|
|
import com.arc.dh.util.AchievementSystem;
|
|
import com.arc.dh.util.Data;
|
|
import com.arc.dh.util.Sound;
|
|
import com.arc.dh.util.SoundSystem;
|
|
import com.arc.flixel.ArcU;
|
|
|
|
public class Pot extends Entity
|
|
{
|
|
|
|
private static const largeSprite:Class = Pot_largeSprite;
|
|
|
|
public function Pot(param1:Number, param2:Number, param3:int)
|
|
{
|
|
super(param1,param2);
|
|
loadGraphic(largeSprite,true,false,12,12);
|
|
addAnimation("pot",[ArcU.rand(0,3)]);
|
|
play("pot");
|
|
immovable = true;
|
|
}
|
|
|
|
override public function kill() : void
|
|
{
|
|
var _loc1_:int = ArcU.rand(0,100);
|
|
if(_loc1_ >= 50)
|
|
{
|
|
if(_loc1_ < 95)
|
|
{
|
|
Data.state.addDiamonds(x,y,ArcU.rand(1,3));
|
|
}
|
|
else
|
|
{
|
|
Data.state.createHeart(x,y);
|
|
}
|
|
}
|
|
++Data.pots;
|
|
SoundSystem.play(Sound.POT);
|
|
AchievementSystem.pots();
|
|
super.kill();
|
|
}
|
|
|
|
override public function update() : void
|
|
{
|
|
if(outside)
|
|
{
|
|
exists = false;
|
|
alive = false;
|
|
}
|
|
super.update();
|
|
}
|
|
}
|
|
}
|
|
|