../
kernel
functions
add
all
apply_delta
assert
atan2
btn
btnp
camera
cd
char
chooser
circ
circfill
clip
cls
color
cos
count
cp
create_delta
create_gui
create_process
cursor
date
del
deli
env
error
exit
fetch
fetch_metadata
fget
fillp
foreach
fset
fstat
fullpath
get_clipboard
get_display
get_draw_target
get_spr
include
input
key
keyp
line
ls
map
max
memcpy
memmap
memset
menuitem
mget
mkdir
mouse
mouselock
mset
music
mv
note
on_event
open
oval
ovalfill
peek
peek2
peek4
peek8
peektext
pget
pid
pod
poke
poke2
poke4
poke8
printh
pset
pwd
readtext
rect
rectfill
rm
rrect
rrectfill
scoresub
send_message
set_clipboard
set_draw_target
set_spr
sfx
sin
socket
split
spr
sspr
stat
stop
store
store_metadata
sub
time
tokenoid
type
unmap
unpod
userdata
vec
vid
window
camera(x,y)
Overview
camera() allows for you to set the relative 0,0 of all graphical operations.
Source: source.lua
Arguments
x
x coordinate to set
y
y coordinate to set
Examples
Sets a player object to be in the middle of the screen
--player object
player={
x=0,
y=0
}
--set the player to be in the middle of the screen
screen={
width=480,
height=270
}
function _update()
camera={
x=player.x-(screen.width/2),
y=player.y-(screen.height/2),
}
camera(x,y)
end
This can be paired with mid() to clamp it to the viewable area, e.g: the map.
Returns
Returns the previous camera's x,y positions.