• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED draw_sprite_pos weird shape

Please someone tell me my coordinates are off.. my brain hurts looking at it :S

The sprite I am trying to draw:
1602946085450.png






And this is how it turns out in my room..
1602946070286.png
GML:
//This is litteraly everything I have
sprite_index = Sprite6;
draw_sprite_pos(
                sprite_index,image_index,
                x-sprite_width,    y-sprite_height,            x+sprite_width, y-sprite_height,
                x-sprite_width,    y+sprite_height,            x+sprite_width, y+sprite_height,
                1);
The reason I am using this function is because I want to make shadows. But for the test purpose I want the sprite to be at least normal looking the angle is just a matter of upper coordinates to the left I assume.
 

Tornado

Member
This is how you display it without distortion:
GML:
draw_sprite_pos(
    sprite_index,image_index,
    x, y,                                // top/left
    x+sprite_width, y,                    // top/right
    x+sprite_width, y+sprite_height,    // bottom/right
    x, y+sprite_height,                    // bottom/left
    1
);
The 4 points are defined in CLOCKWISE direction, beginning from top/left point.

If you want distortion for example in the top/right corner, lets say 200 pixels only in x direction, then:
GML:
draw_sprite_pos(
    sprite_index,image_index,
    x, y,                                // top/left
    x+sprite_width+200, y,                // top/right
    x+sprite_width, y+sprite_height,    // bottom/right
    x, y+sprite_height,                    // bottom/left
    1
);
I'm not into this stuff, never done that before, so I have no clue why sprite's origin doesn't play any role here.
The manual says that those 4 points "define the position of each of the four corners of the bounding box".
https://manual.yoyogames.com/#t=Content.htm&rhsearch=draw_sprite_pos
 
Last edited:
Top