Not Responding Issue (Visibility)

Started by Cenobite888, Wed 19/08/2020 19:17:32

Previous topic - Next topic

Cenobite888

Hi all

Have any of you experienced non responsive behavior in a game when you try to move an invisible object?

The code that works is as below:

function oApple_UseInv()
{
if(cFoxyMonk.ActiveInventory == iStick)
{
  if(Game.DoOnceOnly("StickIsInTree") == true)
  { 
    cFoxyMonk.Walk(129, 174, eBlock, eAnywhere);
    oStick.Visible = true;
    cFoxyMonk.FaceObject(oApple);
    oStick.Move(oApple.X, 48, 4, eBlock, eAnywhere);
    oStick.Move(oApple.X, 170, 4, eBlock, eAnywhere);
    cFoxyMonk.LoseInventory(iStick);
    oApple.Move(oApple.X, 180, 4, eBlock, eAnywhere);
    oApple.Baseline = 0;
    Display("Good shot! The apple falls out of the tree and lands on the ground with a thud.");
   
  }
}
}

If I go and make oStick = True a comment i.e // oStick = True so that the stick remains invisible, and try to move it, the game becomes non responsive like it entered a long thinking loop.

Any Ideas what could be causing this?

morganw

Are you sure that it is non-responsive forever rather than just non-responsive while the blocking actions are running?

Cassiebsg

I've experienced similar behavior. But there's really no point in moving an invisible object. If it's invisible you can't see it, so just change the x, y of it instead (and add a wait, if you need a certain time to elapse as if it was moving). 

I don't think it's possible to move or walk invisible objects/characters, since AGS won't be able to draw them and gets "confused?"... This is my theory anyway.
There are those who believe that life here began out there...

Crimson Wizard

#3
Quote from: Cassiebsg on Wed 19/08/2020 21:33:12
I've experienced similar behavior.

This is not right, drawing and moving are two separate things that should not depend on each other. I'd rather get to the bottom of this, because this sounds like a bug, or some unexpected behavior out of obscure reasons.

Khris

I can confirm this bug; while the visibility of an object should have zero effect on its movements, trying to blockingly move an invisible object indeed makes the engine hang.

Crimson Wizard

#5
Ah, darn, this is the same as an old issue where non-visible objects did not animate, which could also cause infinite waiting block.

Originally in AGS there was no "Visible" property, there was a "on" property, which had different meaning, it was more like "enabled"/"disabled". Disabled objects were not drawn, and were not updated: did not move, animate or anything.
Unfortunately, when Visible was introduced the logic was kept, although it no longer made sense.

morganw

I think the templates still have a reliance on 'player.on' because there is no direct equivalent. It is very confusing. :(

Gilbert

Quote from: Crimson Wizard on Wed 19/08/2020 22:40:43
Ah, darn, this is the same as an old issue where non-visible objects did not animate, which could also cause infinite waiting block.
It's been a long time, but I think I once asked CJ about this but the reply was it's the intentional behaviour as it didn't make sense to move or animate invisible objects.

I wanted it otherwise though. I originally wanted to have a flickering effect (think the invincible time in arcade games) on an moving/animating object by using the .On property. As this didn't work it would involve some extra scriptings for the effect.

Cenobite888

#8
Thanks for all the replies.

I determined it has something to do with the eBlock parameter.

The logic which I am trying to follow is as below:

Character needs to pick up a stick at located (x0,y0)
Stick becomes invisible once character picked it up
Character needs to throw stick at an apple in a tree
When you carry out the instruction "use stick with apple in tree" the character will move to location (x1,y1)
To make the animation of the stick moving from the character into the tree, the stick needs to move from location (x0,y0) to location (x1,y1) while being invisible.
Then the stick will become visible at (x1,y1) and move to (x2,y2) which will make it seem as if the character is throwing the stick into the tree.

The Alternative of moving an invisible item is to probably add a duplicate item at the position you wish for the animation to take place and just keep it invisible until you need it.

The Better alternative is to change the x & y coordinates of the object as CassieBSG rightfully said.  The tutorial also recommends doing this.



Khris

Exactly, to change an object's position instantly, just set .X and .Y directly.

And just for reference, you can use .Transparency = 100 instead to make the object invisible; this shouldn't make the engine hang but I haven't tested it.

SMF spam blocked by CleanTalk