Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: arj0n on Sat 18/08/2012 01:38:31

Title: move 2 object at the same time while using eBlock [solved]
Post by: arj0n on Sat 18/08/2012 01:38:31
Is it possible to move two object at the same time while also using eBlock and if yes, how?
Title: Re: move 2 object at the same time while using eBlock
Post by: Khris on Sat 18/08/2012 01:58:50
Sure:
Code (ags) Select
  oObject1.Move(200, 50, 3, eNoBlock);
  oObject2.Move(200, 150, 3, eBlock);
Title: Re: move 2 object at the same time while using eBlock
Post by: cat on Sat 18/08/2012 11:23:22
Just make sure that the moving that takes longer is the blocking one.
Title: Re: move 2 object at the same time while using eBlock [solved]
Post by: arj0n on Sat 18/08/2012 11:33:38
Quote from: Khris on Sat 18/08/2012 01:58:50
Sure:
Code (ags) Select
  oObject1.Move(200, 50, 3, eNoBlock);
oObject2.Move(200, 150, 3, eBlock);


Thanx Khris, the problem was when I use eNoBlock twice (as shown below) the mouse cursor is shown and I can't seem to hide it.
I hide it in the function room_Load() and the move command is in the room_AfterFadeIn()
A little qustion: why, once the objects starts moving using eNoBlock for both, is the hidden mouse cursor shown again?

Code (ags) Select

oObject1.Move(200, 50, 3, eNoBlock);
oObject2.Move(200, 150, 3, eNoBlock);


But using your version the mouse cursor isn't shown anymore.
'Problem' solved, thanx.

Quote from: cat on Sat 18/08/2012 11:23:22
Just make sure that the moving that takes longer is the blocking one.
No problem Catgasmask, but thanx ;)
Title: Re: move 2 object at the same time while using eBlock
Post by: Khris on Sat 18/08/2012 12:52:07
I'm guessing you're turning the mouse cursor back visible right after moving the objects, right?
If both objects are moved non-blocking, AGS continues executing the subsequent commands immediately after having started the movement, as opposed to waiting until it's finished. That's exactly why the need arises to use eBlock in the first place...
Title: Re: move 2 object at the same time while using eBlock
Post by: arj0n on Sat 18/08/2012 21:15:44
Quote from: Khris on Sat 18/08/2012 12:52:07
I'm guessing you're turning the mouse cursor back visible right after moving the objects, right?
If both objects are moved non-blocking, AGS continues executing the subsequent commands immediately after having started the movement, as opposed to waiting until it's finished. That's exactly why the need arises to use eBlock in the first place...
Ah yes, thanx. That was the problem.
The RepExec which I use for a transparency changing of a gui was causing the mouse to be visible again.
I now added a check to the RepExec if the gui is 100% visible or not and now it works well, also with both object moving using eNoBlock:
Code (ags) Select

function room_AfterFadeIn()
{
gMenu.Transparency = 100;
gMenu.Visible=true;
Wait(180);
oCoverLeft.Move(-513, 768, 2, eNoBlock, eAnywhere);
oCoverRight.Move(1025, 768, 2, eNoBlock, eAnywhere);
}

function room_RepExec()
{
if (oCoverRight.X>1020)
   {
    int trans = gMenu.Transparency;
    while (trans > 0)
     {
      trans--;
      gMenu.Transparency = trans;
      Wait(1);
     }
   }
if (gMenu.Transparency == 0)
{
  mouse.Visible=true;   
}
else if (gMenu.Transparency > 0)
{
  mouse.Visible=false;   
}
}

function room_Load()
{
mouse.Visible=false;
}