Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: AmazingTash on Sun 12/02/2017 11:47:21

Title: [Solved][BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: AmazingTash on Sun 12/02/2017 11:47:21
Dear community,

first, i'm sorry for my grammar. I really try my best. Seriously :-D

I switched a few weeks ago from Visionaire to ags and i'm really excited about it!
For this moment i am a "silent reader" in this Forum and could solve my Problems this way. So far...
For your sorrow, my programming skills are not that high. I read the Scripting Tutorials and
I understand the very low Basics, so i hope I can implement the solution approaches with your help, folks

tl;dr
I used the BASS template from version 3.4 of ags. Now i want that the character goes automatically to hotspots, objects, etc when the player pressed the left mouse.
the right is for looking, so i want that the character don't move.
The same as in the BASS "sequel" Broken Sword/Baphomets Fluch.

thank you, in advanced.
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: Buckethead on Sun 12/02/2017 13:23:40
I could be wrong but, isn't that exactly what the LW_BASS template does already? Could you explain more what it is that isn't working for you?
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: AmazingTash on Sun 12/02/2017 13:35:59
Oi Buckedhead!
Thats strange. When i open and play the "LW_BASS" Template in AGS 3.4, the player doesn't automatically walk to the objects or hotspots when i do a left mouseclick on it.
Not even with "automatically walk to hotspots in lookmode" activated.
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: Danvzare on Sun 12/02/2017 13:36:33
Quote from: Buckethead on Sun 12/02/2017 13:23:40
I could be wrong but, isn't that exactly what the LW_BASS template does already? Could you explain more what it is that isn't working for you?
I think he's wanting the character to walk when he left clicks on something.

Basically, add player.Walk(x, y, eBlock); at the beginning of your code for the interaction of any hotspot or object.
With x and y being replaced by the coordinates you want your character to walk to.
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: Cassiebsg on Sun 12/02/2017 13:42:07
Stupid question, but are you sure your character is on a walkable area?
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: AmazingTash on Sun 12/02/2017 13:59:25
Thank you for all the answers!

Quote from: Cassiebsg on Sun 12/02/2017 13:42:07
Stupid question, but are you sure your character is on a walkable area?

Yes i'm sure :-D


Quote from: Danvzare on Sun 12/02/2017 13:36:33
I think he's wanting the character to walk when he left clicks on something.
Right! Have I explained so badly? :(


Quote from: Danvzare on Sun 12/02/2017 13:36:33
Basically, add player.Walk(x, y, eBlock);

This works. But i am a little afraid... it means more work if we changed some backgrounds later and move objects etc around.
I was hoping to find a "global" solution :)
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: Buckethead on Sun 12/02/2017 14:41:52
Oh sorry must of have missed that part!

What you could do is make your character walk like this:
Code (ags) Select

cEgo.Walk(oObject.X,oObject.Y,eBlock);
cEgo.Walk(hHotspot.X,hHotspot.Y,eBlock);


That way it will still work if an object gets moved. Although in the case of the hotspot you have to set the location to walk to again.
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: AmazingTash on Sun 12/02/2017 15:31:46
Quote from: Buckethead on Sun 12/02/2017 14:41:52
Code (ags) Select
cEgo.Walk(oObject.X,oObject.Y,eBlock);

Nice compromise. Thank you very much to all!
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: Kumpel on Sun 12/02/2017 20:09:33
I just wanna throw in that object.X and player.x are doing two different things. the object.X coordinate leads to the lower left corner of the sprite while the character.x coordinate is pointing to the centre of the sprite's width (usually a characters y-axis). So if you want to make the player go to the middle of your object's sprite, you may have to change the simple "object.X" to "object.X+(Game.SpriteWidth[object[ID].Graphic]/2)" which makes it a tad more complicated to implement and edit.
Title: Re: [BASS Temp] Go auto. to Objects, Hotspots, etc. with left mouse
Post by: AmazingTash on Sun 12/02/2017 20:44:16
Thanks Kumpel,

I noticed earlier and tried to solved this "problem" with something like
Code (ags) Select
cEgo.x+100

your hint makes it easier and cleaner.

Danke!