From the "throw objects" video, Camera/touch offset

the constrain is offset if the camera has been panned using "control camera" ,Ive tried everything.

I even tried incorperating a camera zoom but that also effected the grab area.

its a 2D platformer that I would love to create large toouch screen enviroment for. I want enemies spawned anywhere to be grabbable , and throwable. and when the camera is at origin this works fine. but frankly my zoom in doesnt work after the camera has been panned either. Please Help

Comments

  • ORBZORBZ Member Posts: 1,304
    edited May 2013
    i'm not sure what you are asking... but if you want to see how to grab and throw stuff or if you want to see how to do a camera offset - check out these demos i made a while back:

    Camera Tracking 1/3rd of screen:

    http://gshelper.com/shop/free-templates-and-tutorials/orbzample-camera-tracking-thirds-trick/

    Grab and throw:

    http://gshelper.com/shop/basic-physics/orbzample-throw-a-fire-block/

    Hope that helps :)
  • joshiwujoshiwu Member Posts: 207
    your grab and throw demo is exactly what I have, as suggested by the title. i Used Tshirt booth's "how to throw an object" video. So yes that is what I have . But try this. add a sidescroller character. give him camera control. Use the character to move the came in game, AND THEN try using that grab and throw program. It only works at camera origin
  • joshiwujoshiwu Member Posts: 207
    *camera in game
  • joshiwujoshiwu Member Posts: 207
    so basically combine your two demo's and then try the functionality of the grab and throw .
  • natzuurnatzuur Member Posts: 304
    Hard to understand, but if your talking about using a constrain to touch/mouse type of environment, that needs to go beyond 1 screen size, you'll need to add an offset to it.

    So for example if you knew the camera position is going to be at 2048 or greater (up to 3096 on an ipad) you could do constrain x of actor to game.touches.touch1x+ 2048 to make it work within the camera. You could also just do the same with an unlocked actor to make it dynamic and do constrain x of actor to game.touches.touch1x+Camera origin X
  • natzuurnatzuur Member Posts: 304
    You could also have it control the camera with the control camera behavior, or have it take control based on a boolean so you can drag around a large scene.
  • ORBZORBZ Member Posts: 1,304
    Just include the camera X and Y offset in the calculations. It's available from any scene instanced object. Drop an actor on the scene and then double click it and unlock the actor. Then open the expression editor inside the actor, there will be an option for Current Scene. In there you can find the camera origin X and Y, use those values to offset when you grab. Best to constrain them to a global game attribute so you can get at them from anywhere, not just instance only actors.
Sign In or Register to comment.