# Using image_xscale to flip image_angle?

3 replies to this topic

### #1 Hello Darren

Hello Darren

Pirate

• Banned Users
• 275 posts
• Version:Unknown

Posted 25 April 2012 - 09:43 AM

I want to have it so when I draw a sprite with an x offset and when using image_angle I don't have to first check whether the object has an image_xscale of 1 or 1 then apply the x/angle offset, instead I just want to draw the sprite with a simple calculation in there to get the correct offset.

So for example I'm using the following code instead of x which will automatically apply an x offset of either +3 or -3 depending on whether the object has an image_xscale of 1 or -1.

`x+(3*image_xscale)`

I want to do something similar for image_angle except I don't know how. I want it so if the image_xscale is 1 then image_angle will equal -90 and if the image_xscale is -1 then it will equal 90. How would I do a calculation like that?

Thanks.

Edited by Hello Darren, 25 April 2012 - 11:44 AM.

### #2 Yal

Yal

Gun Princess

• Global Moderators
• 6455 posts
• Version:GM8.1

Posted 25 April 2012 - 10:51 AM

Something like this?

`image_angle = -90*image_xscale`

Also, if you have a problem with a rotated sprite pointing "backwards" when you set image_xscale to -1, you can solve this by simply setting image_yscale to -1 too. Basically, to get rotation to work properly set image_yscale so that it is always the same value as image_xscale.
• 1

### #3 Hello Darren

Hello Darren

Pirate

• Banned Users
• 275 posts
• Version:Unknown

Posted 25 April 2012 - 11:02 AM

Thanks Yal I could of sworn I tried "-90*image_xscale" but it seems to work great.

Edited by Hello Darren, 25 April 2012 - 11:44 AM.

### #4 Yal

Yal

Gun Princess

• Global Moderators
• 6455 posts
• Version:GM8.1

Posted 25 April 2012 - 11:40 AM

Is there any simple way of fixing this with that code instead of me having to go back and redo all the sprites?

For instance you could manually draw the sprite in another position if image_xscale is negative using a mere if check?
• 1

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users