Tracking character by touch beyond screen size

bladeolsonbladeolson Member Posts: 295
edited November -1 in Working with GS (Mac)
I got my character to track my touches. If the touch is great than the center of the character he goes right, if it is less than he goes left.

BUT

he stops when he reaches the edge of the screen.

I have camera tracking and such on, but I am guessing that the touch X and Y are only registered to the initial screen coordinates. So when the touch gets to be beyond 1024 (ipad size ) he just stops.

Any ideas how to make the touch go beyond the initial view?

Appreciate any ideas..

I found an example like missle command , but I could not get this to work with that example.

blade

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    You need to account for the camera offset.

    Create two global game attributes, cameraX and cameraY

    Create a "cameratracker" actor. Just a simple box will do. No code in the prototype.

    Drag this actor into the Scene, just offscreen. Double click on it (and the padlock) to access the Scene Attributes.
    Only Instances can access Scene Attributes. Constrain Scene.Camera.OriginX to game.cameraX and Scene.Camera.OriginY to game.cameraY

    Now you have access to the camera origin (the lower-left corner of the screen at all times)

    You'll need to add cameraX to TouchX to get the correct Touch position.

    Hope this helps!
    Joe
  • bladeolsonbladeolson Member Posts: 295
    Joe:

    That totally worked. I thought it was something like that. I got some pretty awesome movement going now. I will show you soon. thanks a TON for you help.

    This is looking very cool!
  • quantumsheepquantumsheep Member Posts: 8,188
    I've been plagued by the same issue. Now I have eight hours of work before I get home. Plus last night's 'Lost' to watch...

    BUT - AFTER all that, I'm looking forward to giving this a go!

    Thanks Joe - I know it's said a lot but I'm amazed at how generous and patient you are with new joiners, and with old timers alike!

    Cheers!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • JamesLewisJamesLewis Member, PRO Posts: 109
    Hello Joe, Blade, Quantum Sheep etc....

    I'm trying to do exactly the same thing as Blade.

    I've tried your suggestion Joe, but am confused as the where I "add cameraX to TouchX to get the correct Touch position".

    Hence, I now have no moving camera.

    Still learning!

    Look forward to your response.

    James
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hey James,

    You are trying to touch to the right of the character to move the character to the right?
    And left of the character to move them left?

    Does your Scene scroll?
  • QuinnZoneStudiosQuinnZoneStudios Member Posts: 452
    firemaplegames said:
    You need to account for the camera offset.

    Create two global game attributes, cameraX and cameraY

    Create a "cameratracker" actor. Just a simple box will do. No code in the prototype.

    Drag this actor into the Scene, just offscreen. Double click on it (and the padlock) to access the Scene Attributes.
    Only Instances can access Scene Attributes. Constrain Scene.Camera.OriginX to game.cameraX and Scene.Camera.OriginY to game.cameraY

    Now you have access to the camera origin (the lower-left corner of the screen at all times)

    You'll need to add cameraX to TouchX to get the correct Touch position.

    Hope this helps!
    Joe

    This is good stuff!

    So it looks like I can use this same technique to control layers of the background somehow.

    I still want my character to control the camera as normal, but when the camera moves (as opposed to my character moving within the camera control box) I want to be able to move back ground layers in the opposite direction at different speeds.

    I got the first part figured, with the camera actor in the corner but don't fully understand where to go from here to make that happen. If I could get this working, it would be a huge leap in GS for me.

    Thanks in advance to anyone who knows the answer.

    Mike
Sign In or Register to comment.