Setting start camera-position
MarcoCol
Member, PRO Posts: 279
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?
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
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.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
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
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)
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
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
I didn't place the blank actor outside the screen view
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?
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
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