Hi there I’m trying to make a game where you have a number of people in a room and you control them by dragging them and dropping them on the objects you want them to interact with. I already have a drag and drop system implemented, but i cannot manage to figure how to drag only one entity if they are stacked one over another.
Also, when i put the mouse over one of the entities, a pop-up appears over their head that shows name and health bars. I don’t know how to structure it so the bar updates in real time (now, it only shows differences every time you open it up).
The pop-up comes up this way:
> if (touching() && !holding() && !infodisplayed) {
> info = world.add(new Info(this));
> infodisplayed = true;
> countdown = 15;
> }
> if ((!touching()||holding()) && infodisplayed) {
> countdown -= 1;
> if(countdown <= 0){
> world.remove(info);
> infodisplayed = false;
> }
Then the “info” entity does this:
>
override public function added():void
{
hapinessbar = world.add(new Hapinessbar(x, y, myHuman.hapiness));
healthbar = world.add(new Healthbar(x, y, myHuman.health));
nametag = world.add(new Nametag(x, y, myHuman.myname));
}
override public function update():void
{
x = myHuman.x - 5;
y = myHuman.y - 40;
healthbar.update();
hapinessbar.update();
}
How can i manage to keep the bars updated all the time? I’m not even sure what I am doing.
Thanks a lot!