Fixed: Two Issues. 1) World.update() didn’t have super.update(). 2) FlashDevelop’s trace broke.
I thought this was possible but for some reason Input is not working without graphics. Hit box is set up. It works fine with a graphic but take out the graphic and nothing. Any suggestions?
package entities
{ import net.flashpunk.Entity; import net.flashpunk.utils.Input;
/**
* ...
* @author Darrin Adams
*/
public class Cup extends Entity
{
private var bClick:Boolean = false;
public function Cup()
{
this.x = 0;
this.y = 0;
setHitbox(100, 100, 0, 0);
this.visible = true;
}
public function click():Boolean
{
if (bClick)
{
bClick = false;
return true;
}
else
return bClick;
}
override public function update():void
{
if (!visible)
return;
super.update();
if (collidePoint(this.x, this.y, Input.mouseX, Input.mouseY))
{
if (Input.mouseDown)
{
//Press
trace("press");
bClick = true;
}
else
{
//Mouseover
trace("mouseover");
}
}
else
{
// Up with no mouseover
}
}
}
}