Having trouble getting actor to rotate after leaving initial scene area.

I'm trying to get my actor to rotate where I touch on the screen. So far that is working perfectly but only in the initial scene area. When I leave the initial scene area, touch commands only make the actor face the direction of the initial starting area and will not rotate in any other direction.

It's a top down shooter.
The scene area is larger than the camera.
The character rotation is relative to the scene. (When I change it to actor he just spins in a circle)
Rotation position is to touch.x and touch.y
Actor moves with a touch D-Pad.

Please help!
Can send screenshots if necessary.

Thanks!

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2017

    Welcome to the forum ! :)

    Rotate to touch.X + camera.origin.X / touch.Y + camera.origin.Y

    To access camera.origin you will either need to unlock your actor (in the scene) so it can directly access camera.origin.X and Y . . or unlock another actor (for example a new blank actor) and use that to constrain a couple of game.attributes to camera.origin X and Y . . your actor (the one you want to rotate) can then access the camera.origin via these attributes.

    Note . . . Touch position on a device's screen will return your finger/mouse position on the screen, not in your scene, so if you have a 1024 x 768 pixel scene on a 1024 x 768 screen and touch the very middle of the screen your finger will be at 512, 384, if you have an actor that rotates to touch position it will point towards the middle of the screen (512, 384) . . . Now enlarge the scene to 10,000 x 768 . . . move your actor along the scene so it's at the far right (let's say x = 9,000), now touch the middle of the screen and what value do we get this time? We get 512, 384 again because touch is measuring where you touch the screen not where you touch the scene, so the actor will point to the left, to 512, 384 in the scene, which is a long long way to the left.

    Of course if you have a scene size that's the same as your screen you might end up thinking that touch measures where you are touching in the scene, but this just because the two, screen and scene, are aligned, move the camera outside of the original area and they are no longer aligned.

  • cpugamereviewscpugamereviews Member Posts: 3

    How do I go about unlocking my actor to the scene so it can access the camera? Sorry I'm really new to this!

  • IceboxIcebox Member Posts: 1,485
    edited May 2017

    @cpugamereviews said:
    How do I go about unlocking my actor to the scene so it can access the camera? Sorry I'm really new to this!

    You will need some of my skills to do it :#

    If your using windows version choose instance tab instead of prototype

    I think Gamesalad is the only game engine that doesn't allow you to access scene attributes without unlocking the actor. It would be great and we wouldn't have to constrain actor's position to game attributes in many cases , I hope they change it soon :)

  • cpugamereviewscpugamereviews Member Posts: 3

    Thank you. But when I change rotate to touch.x+camera.origin.x/touch.y+camera.origin.y my character no longer rotates at all.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2017

    @cpugamereviews said:
    Thank you. But when I change rotate to touch.x+camera.origin.x/touch.y+camera.origin.y my character no longer rotates at all.

    You've most likely made a mistake when entering the correct values, check you have everything in order.

Sign In or Register to comment.