GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Actor won't go off the border of iphone 5 scene size.

FeathersFeathers Member Posts: 31
edited July 2016 in Working with GS (PC)

Hi. I'm working on a project with an iphone 5 portrait scene.
I've additionally set one scene's size, which is the scene where the game is played, to width(320)*height(1704).

The main actor(Player) has a Rule, when mouse is down-> change velocity :
vectorToAngle(game.Mouse.position.x-self.position.x,game.Mouse.position.y-self.position.y)

relative to: scene at a speed of 150.

This lets the main actor move to where ever the mouse button clicks.
I made the camera follow my main actor with a tracking area of 50*50.

Now, my problem is that everything goes alright except when my actor goes 'up' as much as height 568, my actor acts like there is some kind of border that is stopping it from going higher.

Does anyone know what the problem might be?

The camera follows the actor just fine, but the actor follows the mouse button only when the mouse button is clicking under height 568, the iphone 5 portrait default scene size.

Comments

  • IceboxIcebox Member Posts: 1,483
    edited July 2016

    Try adding camera origin , unlock the actor and access camera origin

    vectorToAngle(game.Mouse.position.x-self.position.x+ Scene.Camera.Origin.X ,game.Mouse.position.y-self.position.y+ Scene.Camera.Origin.Y)

    If you want to do it without unlocking the main actor , you can create 2 real attributes
    call them Cam.x and Cam.y
    create an actor call it camOrigin place it on the scene
    unlock this actor
    constrain game.Cam.X to Scene.camera.origin.x
    constrain game.Cam.Y to Scene.camera.origin.y

    but you will have to do it for every scene.

    Then in your main actor just add game.cam.x and game.cam.y instead of camera origin x and camera origin y , this way you will not be required to unlock the main actor every scene. But avoiding constrains would be better unless it doesnt cause any performance issues. I would use this method for developing , to keep the main actor locked in case i change rules and behaviors , when the game is done , remove the constrains and unlock the main actor. But its just a thing i would do its up to you.

Sign In or Register to comment.