Hi all.
I have again problem with a very difficult code.

As you can see from this image from Leisure Suit Larry 2. The Luggage slides from left to right.
When it on the region where the x-ray window it shows a x-ray image sprite. When it slides out it shows the luggage and it continues to slide right.
And then it begins from the start, sliding another x-ray sprite image on the slider and another luggage image appears too when it comes out of from the x-ray window.
I hope you understood me.
I have two region for this. Region 2 and Region 4.
When the object is on region 2 I want to change the image of the graphic.
And again when it slides on region 4.
In First Loading screen my code is:
Code: ags
Here is my code.
iCode: ags
This code works! The graphic changed in each times the object slides on Region 4 and when it is off the Region 4.
And it continues to move from left to right. And it returns back on the same spot where the object start to move from left to right.
But the problem is I want to change the graphic again 12 times when it goes on same region 4
I hope you can help me with this because this is so difficult for me.
I also tried this code.
Code: ags
That code worked great until I found out about this in Help section: There are 20 available timers, with TIMER_IDs from 1 to
So I could add more Settimer. I hope that will be changed in the next update.
edit......
Thanks to Crimson Wizard he solved this for me. Case Closed.
Code: ags
I have again problem with a very difficult code.

As you can see from this image from Leisure Suit Larry 2. The Luggage slides from left to right.
When it on the region where the x-ray window it shows a x-ray image sprite. When it slides out it shows the luggage and it continues to slide right.
And then it begins from the start, sliding another x-ray sprite image on the slider and another luggage image appears too when it comes out of from the x-ray window.
I hope you understood me.
I have two region for this. Region 2 and Region 4.
When the object is on region 2 I want to change the image of the graphic.
And again when it slides on region 4.
In First Loading screen my code is:
SetTimer(1,275);
Here is my code.
i
function room_RepExec()
{
oThings.X= -50; oThings.Y=158;
if (!oThings.Moving){
oThings.Move(310, 157, -3, eNoBlock, eAnywhere);
}
/////This code lets the object slide from right to left endless.
Region* Taska1 = Region.GetAtScreenXY(oThings.X, oThings.Y);
if (Taska1 == region[4]) {
oThings.Graphic=5903;
SetTimer(1, 175);
}
if (Taska1 != region[4]) {
if (IsTimerExpired(1)){
oThings.Graphic=1425;
SetTimer(2, 800);
}
}
}
This code works! The graphic changed in each times the object slides on Region 4 and when it is off the Region 4.
And it continues to move from left to right. And it returns back on the same spot where the object start to move from left to right.
But the problem is I want to change the graphic again 12 times when it goes on same region 4
I hope you can help me with this because this is so difficult for me.
I also tried this code.
function room_RepExec()
{
oThings.X= -50; oThings.Y=158;
if (!oThings.Moving){
oThings.Move(310, 157, -3, eNoBlock, eAnywhere);
}
if (IsTimerExpired(2)){
SetTimer(1, 0);
oThings.Graphic= 1429;
SetTimer(3, 275);
}
else if (IsTimerExpired(3)){
SetTimer(2, 0);
oThings.Graphic= 5894;
SetTimer(4, 800);
That code worked great until I found out about this in Help section: There are 20 available timers, with TIMER_IDs from 1 to
So I could add more Settimer. I hope that will be changed in the next update.
edit......
Thanks to Crimson Wizard he solved this for me. Case Closed.
// Set these according to your game
#define POSITION_START_MOVE 0
#define POSITION_CHANGE_GRAPHIC 100
#define POSITION_END_MOVE 310
function room_RepExec()
{
// If thing is not moving OR if it just went all the way to the right -
if (!oThing.Moving || oThing.X >= POSITION_END_MOVE) {
// Move thing back
oThing.X = POSITION_START_MOVE;
// Switch to next object's x-ray graphic (set to your sprites accordingly)
switch (oThing.Graphic) {
case 1001: oThing.Graphic = 1100; break;
case 1101: oThing.Graphic = 1200; break;
case 1201: oThing.Graphic = 1300; break;
//... etc
}
// Begin moving through x-ray window
oThings.Move(POSITION_END_MOVE, 157, -3, eNoBlock, eAnywhere);
}
// If thing was moving and just passed x-ray window
else if (oThing.Moving && oThing.X > POSITION_END_MOVE) {
// Change from x-ray to normal graphic (set to your sprites accordingly)
switch (oThing.Graphic) {
case 1000: oThing.Graphic = 1001; break;
case 1100: oThing.Graphic = 1101; break;
case 1200: oThing.Graphic = 1201; break;
//... etc
}
}
}