by Zivouhr » Fri Jul 25, 2014 4:32 am
Sounds like good advice.
I usually have the view have the player as the parent to simplify things, but there is a demo created on this forum, where the stick figure they created moves left or right and the screen scrolls left or right once they hit one of those side regions parented to the view I think. That allows for some slack in the player's left right movement, but if I remember, the demo will give some ideas about not having the view parented to the player, but still follows the player.
Otherwise, you could possibly just assign the same X speed that the player has for his x movement (left or right), without parenting the view. Here's another suggestion; simple way;
View/keydown/left/repeat On/Script editor:
x-=6; // - makes the view go left here. // = notes, not actual code, to inform those new to coding.
View/keydown/right/repeat On/Script editor:
x+=6; //+ makes view go right.
--------
player/keydown/left/repeat On/Script editor:
x-=6; // - makes the player go left here. // = notes, not actual code, to inform those new to coding.
player/keydown/right/repeat On/Script editor:
x+=6; //+ makes player go right.
--------
That will allow the player to move freely left or right, and the camera VIEW will follow those movements, but only if the player is not stopped by a wall. In that case, if you keep pressing right, and the player is stopped, using this coding, then the view will keep moving independent of the player, eventually leaving the player offscreen which wouldn't be the goal.
In that case, you'd definitely want Goettsch's idea, that sounds like it will work, though I haven't tested this out yet.
Just trying to offer some ideas, as I'm learning myself, having completed only my first game.