ID:908444
 
(See the best response by LordAndrew.)
Code:
mob/verb
Shake()
set hidden = 1
if(client)
client.eye = locate(x-1, y, z)
sleep(1)
client.eye = locate(x+1, y, z)
client.eye = locate(x, y-1, z)
sleep(1)
client.eye = locate(x, y+1, z)
client.eye = client.mob


Problem description:

Hey guys, today I came up with a nice little effect of shaking, which happens when successfully landing an attack on someone. It's pretty awesome to me, but it's a little too wild. This throws it around with coordinates, so it jumps tiles at a time. I'd like it if I could move it by pixels instead, but the reference yielded no hints as to how to do this.. except this one bit;

"The eye's step_x/y vars, if present, are also used to allow smooth scrolling of the map. These also obey lazy_eye and edge_limit. "

Anyone have any idea how to achieve such an effect?

Best response
client.pixel_x and client.pixel_y handle pixel offsets for the client's view.

In one of my older projects I had this:

var/earthquake = FALSE

mob
verb
Earthquake()
set category = "Effects"

earthquake = !earthquake

if(earthquake)
var
i = input("Magnitude?") as null | num

client/c

if(i)
var
quake_x = 0
quake_y = 0

while(earthquake)
quake_x = rand(-i, i)
quake_y = rand(-i, i)

for(c)
c.pixel_x = (quake_x % 2) ? quake_x + 1 : quake_x
c.pixel_y = (quake_y % 2) ? quake_y + 1 : quake_y

sleep(1)

for(c)
c.pixel_x = initial(c.pixel_x)
c.pixel_y = initial(c.pixel_y)
Haha, awesome! Thanks, LordAndrew, this helps a ton.