Setting start camera-position

MarcoColMarcoCol Member, PRO Posts: 279
edited September 2012 in Working with GS (Mac)
Hi,

I want to scroll the camera to the left and to the right, if the player push the two buttons. But when the game starts, the player should not be on the left position, but in the middle of the 1960px weight scene. What must I do for this?

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Keep your camera on the far left, in the starting position.

    Then, create a boolean global attribute. Call it "MoveCamera" or something else you like.
    Also create a integer attribute called "How many pressed".

    Now, in each of your buttons put a rule:
    When touch is pressed
    Change attribute game.HowManyPressed to HowManyPressed+1

    Once you have both rules in place, create an actor on screen and unlock it.
    Put a rule:

    When attribute game.HowManyPressed is true:
    Interpolate camera origin X to (whatever you'd like)
    You decide what the duration should be.


    Hope this helps.
  • MarcoColMarcoCol Member, PRO Posts: 279
    Thank you. But I have a mistake in my description: There is no player. The User should control only the camera view. And the position at the start should be the center in the middle of both screens.
  • Mr HansonMr Hanson Member Posts: 94
    Hello @MarcoCol!

    From what i understand, you need to two buttons, one to make the camera to go right and to go left.

    First of to set the camera in the middle you go into scene and change the camera x origin.

    Then create a new lawyer which is not scrollable. Create two actors, one for each button. On the left button:

    Create rule that if touch is pressed

    Set a timer to every 0 seconds ( i know timers are not that good but it does what you want.

    Then in that timer change attribute scene.camera.origin.x TO scene.camera.origin.x -1.

    This will make it go left when touched. You might want to add another rule that if camera origin is less than scene stop moving ect.

    Repeat the same progress for the right button except say + 1 instead of - 1. Again you may want to add an extra rule.

    If thats too slow then change the values used till you find the speed you want.

    Hopefully thats what you wanted or gets you on the right track!

    All the best

    JonAPP
  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi,
    what actors must I put in the "not scrollable" layer? All buttons, right?
    If I do this, nothing happens, when tapping the buttons.
    But my main-problem isn't that I can't moving. my problem is, that the camera at the start is set to the left end of the scene. I change the origin x to the center of that point, the game view should start, but it doesn't work.
    So how can I set the game-start-view to the middle of the complete scene (which is 1960px weight)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited September 2012

    Hi @MarcoCol

    Place a blank actor on-screen but outside of the screen view area. In it, put

    Change attribute scene.Camera.Origin.X to 980
    ----and the following if needed---
    Change attribute scene.Camera.Origin.Y to ???

    The buttons go into the non-scrollable layer group, yes; with the background image in a "folder" layer set to scrollable. The Rules in your buttons as referred to by @Braydon_SFX and explained by @JonApp.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • Mr HansonMr Hanson Member Posts: 94
    Hello @MarcoCol

    I don't think i explain it well enough them but i just made a quick template to explain which works if you want it PM your email.

    Other wise just create a new layer that is not scrollable. In that layer that is where you

    place your buttons, in this, left and right. On these buttons it should have (according to

    my way of doing it) if touched, change current scene. camera origin X to current scene.

    camera origin X +1 in a timer which happens every 0 seconds.This is for the button to

    make camera go right. To go left change it to -1. These are all in the new layer you

    created which is not scrollable which means it stays at camera view the whole time.

    Everything else that is not the buttons and is part of the scene should be placed in the

    background layer which is scrollable.

    Hopefully that made a bit more sense

    All the best
    JonApp
  • MarcoColMarcoCol Member, PRO Posts: 279
    Hi, thanks to you both. Now it works.
    I didn't place the blank actor outside the screen view
  • MarcoColMarcoCol Member, PRO Posts: 279
    One additional question:
    How can I set, that if the screen moves on the left side to X0 and on the right side to X1960, that it doesn't move?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi again Marco, name the actor outside of the screen something easy to recognise; find it in its folder in Layers, and then drag it into the folder you've got set for not scrolling (the one with your button actors in).

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MarcoColMarcoCol Member, PRO Posts: 279
    Then the moving stops, when reaches the end of each scenes?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Apologies, Marco, I don't fully understand what you're asking; could you explain with more words?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • mrpacogpmrpacogp Member Posts: 400
    Just found it this thread looking for something to move camera more near to my actor player, and solved using the same size for tracking area on camera. Maybe this can help u too or another looking for that info.
Sign In or Register to comment.