E
Ephemeral
Guest
Please help me figure this out.
My attempt at creating a surface-drawing script similar to draw_sprite_pos() has run into a snag.
Here is the script:
The result of
is as expected.
However, the result of
is this, which I am at a loss for how to fix.
How does GMLs built in draw_sprite_pos() handle this?
My attempt at creating a surface-drawing script similar to draw_sprite_pos() has run into a snag.
Here is the script:
Code:
///@description draw surface perspective
///@param x
///@param y
///@param surface
///@param distort
///@param squish
var surface_id = argument2;
var distortion = argument3;
var squish = argument4;
// Vett Arguments
if (!surface_exists(surface_id)) return false;
var flat_width = surface_get_width(surface_id);
var flat_height = surface_get_height(surface_id);
// Vertex Placement
var tlx = (argument0 - (flat_width / 2)) + distortion; // Top Left
var trx = (argument0 + (flat_width / 2)) - distortion; // Top Right
var blx = (argument0 - (flat_width / 2)) - distortion; // Bottom Left
var brx = (argument0 + (flat_width / 2)) + distortion; // Bottom Right
var top_y = (argument1 - (flat_height / 2)) + squish; // Top
var bot_y = (argument1 + (flat_height / 2)) - squish; // Bottom
// Vertex Drawing
var texture_id = surface_get_texture(surface_id);
draw_primitive_begin_texture(pr_trianglestrip, texture_id);
draw_vertex_texture(tlx, top_y, 0, 0);
draw_vertex_texture(blx, bot_y, 0, 1);
draw_vertex_texture(trx, top_y, 1, 0);
draw_vertex_texture(brx, bot_y, 1, 1);
draw_primitive_end();
return true;
Code:
draw_surface_perspective(x, y, srf_persp, 0, 256);
is as expected.
However, the result of
Code:
draw_surface_perspective(x, y, srf_persp, 256, 0);
is this, which I am at a loss for how to fix.
How does GMLs built in draw_sprite_pos() handle this?