[SOLVED] How do you make a SS Function?

How do you go ahead and make side scrolling in processing?

1 Like

The basic idea of a side scroller is that the world moves around while the player stays still, or at least on screen (i.e super mario). To do this you can use x and y variables to record the amount of scrolling. The values you apply to these variables will be the opposite of what you would apply to the player

Visuals such as tiles or AIs need to be able to move around to simulate the player moving. To do this you just apply the scrolling variables to the object’s actual positions

newObjectPositionX = objectPositionX+worldScrollX;
newObjectPositionY = objectPositionY+worldScrollY;

displayObject(newObjectPositionX,newObjectPositionY);

One of the bigger challenges of making a side scroller is that the positions of things are less obvious, so it may be kinda mind bottling when doing things such as collisions

I hope this helps

1 Like

Some prev posts that are relevant:

Zooming and Panning headache - Processing 2.x and 3.x Forum

Constraining an image while panning and zooming - Processing 2.x and 3.x Forum

Zooming and Panning - Processing 2.x and 3.x Forum

Kf

1 Like