package game;

import openfl.display.BitmapData;
import openfl.media.SoundChannel;
import openfl.media.SoundTransform;
import raycaster.Sprite;

class GameSprite extends Sprite {
	public static final SOUND_DISTANCE:Float = 90;

	public var remove:Bool = false;

	public function new(from:BitmapData, ?x:Float, ?y:Float) {
		super(from, x, y);
	}

	public function update(delta:Float) {}

	public function getSoundTransform():SoundTransform {
		var vol = (SOUND_DISTANCE - distance) / SOUND_DISTANCE;
		var pan = (16 - screenX) / 32;
		return new SoundTransform(vol, pan);
	}

	public function transformSound(soundChannel:SoundChannel) {
		soundChannel.soundTransform = getSoundTransform();
	}
}
