I gave a break to flashpunk for working with javascript but making games in javascript looks like too much hard… So, i came back…
But i have a disturbing problem, i’m so confused…
I added Comments to the code about my problem
package
{
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.graphics.Image;
import net.flashpunk.graphics.Text;
import net.flashpunk.utils.Draw;
import net.flashpunk.utils.Input;
/**
* ...
* @author Bora Kasap
*/
public class ComboView extends Entity
{
private var _combomin:int = 0;
private var _timemin:int = 300;
private var _timermin:int = 0;
private var _minbox:Text;
private var _graphicfx:Image;
public function ComboView()
{
this.x = 50; //i'm setting x
this.y = 50; //i'm setting y as you see
refreshMin(); //i'm drawing a text at this position "Min: 1"
}
private function refreshMin():void
{
this.graphic = _graphicfx = new Text("Min: " + _combomin.toString(), this.x, this.y);
}
public function min():void
{
_combomin++;
refreshMin();
_timermin = _timemin;
}
override public function update():void
{
super.update();
if (_timermin > 0) _timermin--;
else if (_combomin > 0)
{
_combomin = 1;
refreshMin();
}
}
override public function render():void
{
super.render();
Draw.rect(this.x, this.y, this._timermin, 3); //I'm not changing x and y positions of this entity but rect(combo timer bar) and text not positioning on same coordinates like in the image. Actually rect drawing on true position but text positioning on x:100 y:100 and i can't understand why this is happening
}
}
}