A
Amegatron
Guest
Hello! Once again I got some troubles with GMS and still do not understad it, maybe because I'm still new to it.
What do I have:
1) A 256x256 sprite called spr_moon which has the following checkboxes set to true: tile (both horiz and vert), separate texture page.
2) I'm drawing a textured polygon using
My code is such inside one of object's Draw script:
The problem is that when I launch the game, the texture is tiled really weird, see this screenshot:
But, if invoke
Could you please help me understand: is it either me not understanding something, or it is GMS2 again being buggy?
What do I have:
1) A 256x256 sprite called spr_moon which has the following checkboxes set to true: tile (both horiz and vert), separate texture page.
2) I'm drawing a textured polygon using
draw_vertex_texture
function.My code is such inside one of object's Draw script:
GML:
var tex = sprite_get_texture(spr_moon, 0);
var texWidth = 256;
var texHeight = 256;
draw_primitive_begin_texture(pr_trianglelist, tex);
for (var i = 0; i < ds_list_size(upperPolygonTriangles)/2; i++) {
var _x = ds_list_find_value(upperPolygonTriangles, i*2);
var _y = ds_list_find_value(upperPolygonTriangles, i*2 + 1);
var _u = _x / texWidth;
var _v = _y / texHeight;
draw_vertex_texture(_x, _y, _u, _v);
}
draw_primitive_end();
But, if invoke
game_restart()
function (I bind "R" key for that), the game restarts as it is supposed to, and then the level is drawn absolutely fine:Could you please help me understand: is it either me not understanding something, or it is GMS2 again being buggy?