Spawn actor to mouse position on an endless runner
FireCroc
Member, PRO Posts: 69
Hi,
I am trying to spawn an actor to the mouse position on an endless runner where the screen is touched. When the screen starts scrolling and the screen is touched the actor does not spawn by the mouse position. Looks like the spawn is somehow offset
I used
On mouse click spawn the actor as follows:
SPAWN Actor
POSITION: game.Mouse.Position.X
POSITION: game.Mouse.Position.Y
Please help
Comments
I Googled offset actor position gamesalad scroll and the first result seems promising.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Awesome, thanks Tatiang. I will check it out
looks like the video is not available. Tried searching on google but no luck
You're right... sorry about that! Maybe someone else can help out... I checked his YouTube channel and didn't find it there either.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Here's one way. Mouse X and Y (and Touch X and Y) is relative to the screen, not the scene camera. So wherever on the scene your camera is, a touch in the bottom left corner will be at 0,0. Even if your camera is thousands of pixels into the scene. You just need to work out how far the camera is offset and apply that to your spawn. Only unlocked actors have access to the camera attributes, so this is one of the rare instances when you should unlock an actor.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I always liked this explanation:
https://forums.gamesalad.com/discussion/comment/561402/#Comment_561402
Thanks Armelline and RThurman these explanations make sense now. I am sorted.
Thanks for your help.