Shake a image from code

BlitzMax Forums/BlitzMax Programming/Shake a image from code

Sanctus(Posted 2009) [#1]
How could one do that?
I'm thinking of some trigonometry stuff. I use sin and cos for a lot of nice visual effects but still...?
Do you guys have a cool ideea?


EOF(Posted 2009) [#2]
You could use Rnd() to offset the images current location by a small amount

const RANGE#=2.0
Global ox#,oy#
Global imgX#=320 , imgY#=240

Repeat
 ox=Rnd(-RANGE,RANGE) ; oy=Rnd(-RANGE,RANGE)
 DrawImage myimage,imgX+ox,imgY+oy
Until KeyHit(KEY_ESCAPE)