Sidescroller

by Forum_account
Sidescroller
This library gives you the basic movement system of a platformer. You can make an action/platform game in minutes!
ID:1786323
 
I believe this is more or less the exact code used within the library. After moving a certain amount vertically(and perhaps horizontally too), the background will overlay the screen, I'm assuming because it is a mob but unfortunately I've yet to find a way around fixing this.

Suggestions?
mob

var
Background/my_background

Login()

..()

// The background proc just creates the background image, it doesn't
// make it displayed. We have to store the return value (which is a
// datum of type /Background) and call its show() proc to make it shown.
my_background = background('Citybackground.png', REPEAT_X + REPEAT_Y)
//g.layer=OBJ_LAYER

// This will make the background be displayed. You can call the hide()
// proc later to hide it. You can create many backgrounds and have them
// all shown at the same time.
my_background.show()

camera.lag = 0

// This proc is automatically called each tick to give you
// a chance to set the px and py of each background object.
set_background()
if(my_background)

// The background object isn't an atom, but it has px and py vars.
// These vars set it's position relative to the center of the player's
// screen. We set their values based on the player's position so the
// background scrolls as you move.
my_background.px = -px * 1.2
//my_background.py = -py * 1.2
my_background.py = -py * 1.0

/*
Background
vars
image/image
This is how the background image is displayed. If we just used
objs, every other player would be able to see your background. So,
we use images and attach them to an obj. You shouldn't ever have
to access this directly.

obj/object
If we used an obj to display your background, every other player
would be able to see it. So, we leave this obj blank but attach
images to it. The mob's set_camera proc adjusts the position of
this object to position the background based on px and py. You
shouldn't ever have to access this directly.

mob/owner
The mob that the background image is displayed for. Because the
position of the background can be different for different players,
you need to create a /Background object for each player.

px, py
The offset of the background image in pixels. By default (0, 0) the
lower left corner of the image is in the center of the screen.

width, height
The width and height of the image used to create the background.

procs
hide()
Removes the image from the owner's image list and removes the
/Background object from the owner's backgrounds list.

show()
Adds the image to the owner's image list and adds the /Background
object to the owner's backgrounds list.
*/