How to shift sprites?

M

Maximilian Levine

Guest
I am trying to make a scrolling background and need a function that can shift the sprite.
For example, here would be the sprite before being shifted:

Then after being "shifted" left a few times:

So it loops back over
 

pipebkOT

Member
@Maximilian Levine

shift? like, change the sprite? if is that, you can change the sprite with

Code:
sprite_index= name of the sprite


if you want to mirror a sprite (flipping it) you can use

Code:
image_xscale=-1

if you want to rotate a sprite you can use

Code:
image_angle=the angle that you want (in numbers from 0 to 360)
 
B

Bayesian

Guest
You'll want to use draw_sprite_part. For the math you need to know the starting off set, the difference between the starting offset and the current offset which should be floored and finally you need to mod the difference by your sprite width so that it wraps around.
 
Top