Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: smartastreacle on Fri 16/09/2022 12:43:18

Title: Object on object (Solved)
Post by: smartastreacle on Fri 16/09/2022 12:43:18
Hi,

Let's see if I can explain this well:

I have a country scene object (A) bigger than the display area which I want to move around so it looks like we are flying over it. I have another object (B) which may be a windmill which I wish to animate. Object B starts out of the display area and appears when we move the scene (A). My question is - can I anchor B at coordinates on A so it moves with A and so treat A as a background? For various reasons I can't do a normal background thing. Hope this is clear? Any advice welcome. I see there are changes being made to the forum, hope this question appears.   
Title: Re: Object on object
Post by: heltenjon on Fri 16/09/2022 14:36:08
Would it work if you made both objects characters and had the one follow the other, perhaps? I believe follow_exactly is what is most commonly used for shadows and the like, so it may work in this case, too.
Title: Re: Object on object
Post by: Khris on Fri 16/09/2022 15:38:41
You can keep moving the windmill object in relation to the scene one.
Example code:
Code (ags) Select
  oWindmill.X = oGround.X + 234;
  oWindmill.Y = oGround.Y - 345;


You either call this after moving the ground or inside repeatedly_execute.
Title: Re: Object on object
Post by: smartastreacle on Fri 16/09/2022 17:14:08
Great stuff both. I will try them and update. Thank you.
Title: Re: Object on object
Post by: smartastreacle on Sun 18/09/2022 13:17:53
I tried both and they both work. However, I prefer to keep moving the windmill object in relation to the scene object method because I don't want too many characters: although I have used the character idea before and it worked.  (nod)
(I have edited this because I got it the wrong way round!)