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:921410
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
These apply to both Pixel_Movement and Sidescroller


pcx and pcy

These variables track the true center of the mob based on its bounding box. pcx and pcy stand for "Pixel Center X" and "Pixel Center Y" respectively.

//current workaround to make it work
mob
var
pcx=0
pcy=0

set_pos(nx, ny, map_z = -1)
..()
pcx=px+pwdith/2
pcy=py+pheight/2


This makes it much less time consuming when handling cases which are calculated from the center of mobs instead of their positions on the map.


camera.offset_x and camera.offset_y

This is used to modify the camera position after all automated camera positioning via SLIDE or FOLLOW camera types.

//current workaround
Camera
var
offset_x=0
offset_y=0

mob
set_camera()
..()
camera.px+=camera.offset_x
camera.py+=camera.offset_y


This is useful for moments when you want to momentarily change the players bounding box without jiggling the camera about, or while the mod is in a cinematic. It can also be used to shake the screen to display rumbling or damage.
I think I have camera.pixel_x/y vars added but didn't post the update yet (or maybe I posted it for the PM lib and not the SS lib).

I can see how having the coordinates of an atom's center would be useful. Though, I'd also think there are a lot of situations where having the center is only part of something larger (ex: positioning one atom to be centered over another atom) so I'm not sure how much it'd help to have the center coordinate (or if it'd be better to just add the other features that you might use it for).