---
name: "draw_sprite_h_flip"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/draw_sprite_v_flip"
---

# draw\_sprite\_h\_flip(3alleg)

Draws the sprite transformed to the destination bitmap. Allegro game programming library.

Part of [draw\_sprite\_v\_flip(3alleg)](/draw_sprite_v_flip/3alleg.md).

## NAME

draw\_sprite\_v\_flip, draw\_sprite\_h\_flip, draw\_sprite\_vh\_flip - Draws the sprite transformed to the destination bitmap. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**void draw\_sprite\_v\_flip(BITMAP \*bmp, BITMAP \*sprite, int x, int y);**

**void draw\_sprite\_h\_flip(BITMAP \*bmp, BITMAP \*sprite, int x, int y);**

**void draw\_sprite\_vh\_flip(BITMAP \*bmp, BITMAP \*sprite, int x, int y);**

## DESCRIPTION

These are like draw\_sprite(), but they additionally flip the image vertically, horizontally, or both, respectively. Flipping vertically means that the y-axis is reversed, while flipping horizontally means that the x-axis is reversed, between the source and the destination. This produces exact mirror images, which is not the same as rotating the sprite (and it is a lot faster than the rotation routine). The sprite must be a memory bitmap. Example:

```
   if (key[KEY_RIGHT])
      draw_sprite(screen, hero_right, pos_x, pos_y);
   else if (key[KEY_LEFT])
      draw_sprite_h_flip(screen, hero_right, pos_x, pos_y);
   else
      draw_sprite(screen, hero_idle, pos_x, pos_y);
```

## SEE ALSO

[**draw\_sprite**(3alleg)](/draw_sprite/3alleg.md), [**bitmap\_mask\_color**(3alleg)](/bitmap_mask_color/3alleg.md), [**exsprite**(3alleg)](/exsprite/3alleg.md)
