How do i make the screen scroll on press of down arrow?

hi im new to this and trying to make a drag and drop building game but cant figure out how to make the screen scroll on a button press.

heres what im trying to do;
screen size of the game is 800x600 i have a floor 2000x2000 and want to use the arrow buttons to be able to scroll around the 2000x2000 area with the objects that have been placed on it to stay fixed in the same position (like scrolling round a map)

any help will be much appreciated

Make an event like this:

Key Down is pressed
Timer “movement” is great than 0.25 seconds

Reset timer “movement”
Do +50 to the y position of camera [/code]

And another like this:

Timer “movement” is greater than 0.25 seconds
Key Up is pressed

Reset timer “movement”
Do + 50 to the y position of camera.[/code]

Then you will be able to scroll up and down (you might want to experiment with different values where I put 0.25 and +50). You can do a similar thing for camera x position.

Wow thanks that worked perfectly i must admit this program is slightly confusing me but im getting there :slight_smile: and thanks for the speedy reply

DW, if you don’t understand anything, just ask here in the forum. But make sure you’ve read the tutorials and articles in the wiki and also searched first before making a new post. Good luck! :smiley:

If you ever have a problem, there is almost always someone on the forum who will offer you a decent solution. :wink:


Now my game is coming together abit i want the scrolling to be smooth instead of it jumping 50px a time is there anyway i cn implement this into the current code or will i have to change how i go about it, also how do i set it so it only scrolls around my background without showing the white space? Iv looked around the forum but cnt seem to get close to what i want it to do

Try using linear interpolation :slight_smile:

thanks iv got it sorted now