Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Maverick on Tue 01/08/2006 14:02:46

Title: Leapfrog puzzle (Solved)
Post by: Maverick on Tue 01/08/2006 14:02:46
I'm working on a puzzle which is pretty much the same as the slider puzzle  here  (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=24284.0.)

I'm working on a puzzle, which is pretty, much the same as the slider puzzle here. The only difference is that the background contains only 7 horizontal blocks. There are 6 objects (7 if you include
Title: Re: Leapfrog puzzle
Post by: Alynn on Tue 01/08/2006 14:12:55
One way to make it "jump" would be to make it use a walkable area, and have your walkable areas leap over the other spaces, This would be easiest

More difficult would be to use the math functions and calculate the jump motion and have it move that way.
Title: Re: Leapfrog puzzle
Post by: SSH on Tue 01/08/2006 14:42:32
Object baselines determine whether one object is drawn in front of another, and you can use the "Z" co-ordinate to give an object height, it would be easy to do a Z-co-ord jump where the trajectory was shaped like a "^".

As for the end-locations not working, I'm not sure which bit of code that you have is supposed to be checking for this situation... can you elaborate?
Title: Re: Leapfrog puzzle
Post by: Maverick on Tue 01/08/2006 20:06:18
Quote from: SSH on Tue 01/08/2006 14:42:32
As for the end-locations not working, I'm not sure which bit of code that you have is supposed to be checking for this situation... can you elaborate?

I edited my post to include the code that checks if the puzzle is solved.
I managed to resolve the slider pieces going out of alignment ( if I used the code that I posted in the actual game code it would have worked the first time around but thats what you get for working on stuff till 02h00 am).

As for the second part of my problem, I still have to find a way to make the slider pieces "jump". Alynn mentioned that I can use a walkable area but as I'm already using one for the slider pieces to move on a horizontal line, how do I code it so the slider pieces will use walkable area 1 when they need to move to the adjacent empty square and walkable area 2 when they need to "jump" over an obstructing pieces?

Would it work if I changed this line of code:
ob.Move(ob.X+80, ob.Y, 3, eBlock);

to
GetWalkableAreAt(ob.X, ob.Y-40);
ob.Move(ob.X+80, ob.Y, 3, eBlock);

if I include a second walkable area above the slider pieces?
Title: Re: Leapfrog puzzle
Post by: SSH on Tue 01/08/2006 20:26:01
If you use the Z coordinate I mentioned, you only need the walkable areas that you already have
Title: Re: Leapfrog puzzle
Post by: Maverick on Tue 01/08/2006 20:50:29
It is exactly what I want (I think) but just for a moment assume that you are dealing with a total idiot that knows very little about coding, how would such a mentally challenged individual go about changing the z property of an object. I read in the manual that you can change the z property of a character but couldn't find the same "type" of command, which allows you to change this parameter for an object. ::)
Title: Re: Leapfrog puzzle
Post by: SSH on Wed 02/08/2006 09:59:21
Ooops, it may only exist for Characters, not objects! Sorry!
Title: Re: Leapfrog puzzle
Post by: Maverick on Wed 02/08/2006 19:28:20
Thanks SSH!

I got it to sort of do what I want by using:
ob.Move(ob.X, ob.Y-40, 3, eBlock,eAnywhere);
ob.Move(ob.X+40, ob.Y, 3, eBlock,eAnywhere);
ob.Move(ob.X, ob.Y+40, 3, eBlock,eAnywhere);

Although this works just fine its not exactly what is was hoping to do.
I'll just have to redraw the graghics to someting that would be more suited to this type of movement.Ã,Â