Viewing Hitboxes


(Arian Allenson Valdez) #1

God knows I searched the docs. But how do I view the hitboxes? Thanks


(David Williams) #2

In your world’s constructor, you can call: FP.console.enable(); And then use the tilde key (`) to pull up the console where you can then see hitboxes. Or, you can override your world’s render function, similar to this:

	override public function render():void
	{
		super.render();
		var o:Array = new Array();
		getAll(o);
		for each (var e:Entity in o)
		{
			Draw.hitbox(e, true, 0xFF0000, 1);
		}
		
	}

(Evgeniy) #3

very useful to bind some key to this:

if (Input.pressed(Key.F5)) hitboxesVisible = !hitboxesVisible;

where “hitboxesVisible” - boolean variable, and now in override public function render() -

		if (hitboxesVisible)
		{
			var o:Array = new Array();
			getAll(o);
			for each (var e:Entity in o)
			{
				Draw.hitbox(e, true, 0xFF0000, 0.5);
				
			}
		}