[Solved] Camera move up and down with key press (for scrolling text)

Hello. I have a quest log set up, working nicely, but I now want to be able to scroll up and down the list of quests if it gets too long to see on screen. I have the things I want to scroll on a unique layer. I thought it would be a simple case of ‘CameraY()+something’ when a button is pressed. I can get the camera to move once, up or down, by the number I use in the expression, as many times as I want… but that’s it. If I hold the button down the camera does not continue to move, and if I press up or down more than once it doesn’t budge again either. In other words, I can only move it up or down once by the number in the expression, and no further.

This is what I have used for my quick experiment:

What am I missing? My parallax scrolling uses almost the same actions and works great, though obviously without a button press needed to make it move (it runs every frame). Many thanks in advance for any help.

Edit: I think I will move the object (quest list) up and down with a button press instead, and then it’s easier for me to mask the object. It would still be useful to know about the above, if anyone has time. I’m not very experienced with cameras and would love to understand better. I read the Wiki page and didn’t manage to solve my original issue.

I believe the code is adding the Y() value of the default layer instead of the layer you’re trying to move. So, it moves 50 pixels from the default layer in either direction.

You would need to add the layer’s name or change the set to add and use a value.

1 Like

I can’t believe I missed that. You can’t tell from there, but I am blushing! Thank you. I seemed to have a mental block today and didn’t look at the ‘set to’, ‘add’ bit! That worked. Thank you again.

Edit: For clarity for anyone else who might read this: I was managing to target the correct layer using the event I pasted into my original post, so that wasn’t the issue: the layer I wanted to move was indeed moving. It was the ‘set to’ thing that got me. I was setting the camera to jump 50 pixels up or down, but not adding to it. So the camera was jumping once by 50 pixels and not moving continuously like I wanted. ‘add 50’ solved it.

1 Like