Help: my camera scroll code isn't working

jexadox

  • Posts: 35
I got a little bugged with the prebuild camera follow behavior. So I found a way to add a dynamic to it. I set the scroll speed to 1 (a nice lazy scroll that centers the camera on the player if he's only walking). But (with Jump and Run Movement prebuild behavior set to 20 you easily run outside the camera).

So I added some code to the camera. I added a new update/always page. I got it to work perfectly for moving in the positive X direction. The player runs to the edge of the screen and 'pushes' the camera with him till he hits something (the edge of the scene). If the player stops in the middle the camera still slowly centers itself. Here's the code I got to work perfectly:
[see picture 1]

Now, I can't get the camera to do the same thing the other direction: negative X. You can't just flip all the plus' to minus'. You have to account for the width of the player (self). But I've run through the code logically several times and it *should* work in my head.
Especially since this worked in the X positive direction. Anyway, here is the code I can't get to work:
[see picture 2]

colburt187

  • *
  • Posts: 2416
whats going wrong in the game? have you turned on debug mode so you can see where the camera is moving on the screen?

Does the logic for the negative X work if you turn of the  X+ event?

jexadox

  • Posts: 35
if you go past the camera in -x direction, you can leave the screen. the camera scroll continues moving at the normal speed. i dont know how to turn debug mode on, what is that?

colburt187

  • *
  • Posts: 2416
Select the enable debug drawing.

What happens if you turn of the forward moving aspect of it? I'm wondering if that is maybe interfering with it.