In ordinary scrolling, a sprite can move in only four directions; up (0 degrees), down (180 degrees), left (-90 degrees), and right (90 degrees). However, in multidirectional scrolling you can scroll in any direction intended by the degree. This is often used in birds eye scrolling games and can be very useful at times.

Movement Control

Put this script in the sprite that you want to control the scrolling with (i.e. the race car or player). The below part of the script will control the direction you are pointing in.

when flag clicked
forever
if<key [left arrow v] pressed> then
turn ccw (5) degrees
end
if<key [left arrow v] pressed> then
turn cw (5) degrees
end
end

The next part of the script can be coded in two different ways. One way can be coded very simply if the sprite controlling the scrolling is a person. In this version of the code, if no keys are pressed all sprites will immediately stop scrolling. The second option to scripting this part is a bit more advanced. It can be used so that when no keys are pressed, the sprite will drift to a stop, providing a smooth, car like scrolling experience.

Method 1 (Easy Way)

Add this script inside the previously made forever loop

if<key [up arrow v] pressed> then
set [Speed v] to [5]
end
if <key [down arrow v] pressed> then
set [Speed v] to [-5]
end

Method 2 (Hard Way)

Add this script inside the previously made forever loop

if <key [up arrow v] pressed> then
if ((Speed) < [5]) then//"5" is the maximum speed you can scroll at
change [Speed v] by [0.1]
else
set [Speed v] to [5]
end
else
if <key [down arrow v] pressed> then
if ((Speed) > [-5]) then//"-5" is the maximum speed you can scroll at going backwards
change [Speed v] by [-0.1]
else
set [Speed v] to [-5]
end
else
if(not ((Speed) = [0])) then
if ((Speed) > [0]) then
change [Speed v] by [-0.1]
else
change [Speed v] by [0.1]
end
if (([abs v] of (Speed)) < [0.1]) then //Needed because otherwise errors in double-point precision will cause the number to stay above zero.
set [Speed v] to [0]
end
end
end

Scripting the Scrolling Movement

This is the last part of the script. This is the most important part and will enable you to use your multidirectional scrolling.

change [Scroll X v] by (([sin v] of (direction)) * (Speed))
change [Scroll Y v] by (([cos v] of (direction)) * (Speed))

Scrolling Sprites

Next you will need to make the other sprites scroll. To do this, place the below script in all the sprites acting as the "background" and scrolling.

when flag clicked
forever
set x to ((Scroll X) + ((0) * (480)))//to make the sprite farther over change 0 to 1 or even more
set y to ((Scroll Y) + ((0) * (360)))
end