---
name: "draw_sprite_vh_flip"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/draw_sprite_v_flip/3alleg4"
---

# draw\_sprite\_vh\_flip(3alleg4)

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

Part of [draw\_sprite\_v\_flip(3alleg4)](/draw_sprite_v_flip/3alleg4.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**(3alleg4), **bitmap\_mask\_color**(3alleg4), **exsprite**(3alleg4)
