Skip to content

File strips are displaying incorrectly #38

@SoupTaels

Description

@SoupTaels

What version of Collage are you using?

v1.0.1 alpha

Description

Sprite strips only seem to work correctly if they're perfectly square. Sometimes they show both sprites, other times incorrect sprites, but if the sprite resolution is perfectly square, then the sprite actually displays correctly. I've done further testing with the default sprite_add function and strips display correct there no matter what.

I've made a test demonstration using Sonic Mania sprites. I have a control sprite(right) and a sprite I intentionally padded out width wise(left). Top row are Collage sprites, bottom sprite_add.

Here's the code.

CREATE EVENT:
soupTex_test = new Collage("Test"); //Create a texture page for these sprites
soupTex_test.StartBatch();
	soupTex_test.AddFileStrip("spr_sonic_collage_no_strip12.png", "sonic_no", , , CollageOrigin.CENTER, CollageOrigin.CENTER); //Add sprite to texture pack
	soupTex_test.AddFileStrip("spr_sonic_collage_yes_strip12.png", "sonic_yes", , , CollageOrigin.CENTER, CollageOrigin.CENTER); //Add sprite to texture pack
soupTex_test.FinishBatch();
soupTex_test = soupTex_test.ToStatic(true, true);

sonic_normal = sprite_add("spr_sonic_collage_no_strip12.png", 12, false, 0, 0, 0);
sonic_normal2 = sprite_add("spr_sonic_collage_yes_strip12.png", 12, false, 0, 0, 0);

DRAW EVENT:
var sonic_no = asset_get_index("sonic_no"), sonic_yes = asset_get_index("sonic_yes"), anim = current_time/ 100, scale = 2;
draw_set_halign(fa_center); draw_set_valign(fa_middle);
if ( sonic_no != -1 ) {
	var w_ = sprite_get_width(sonic_no) * scale, h_ = sprite_get_height(sonic_no) * scale;
	draw_text_color(320 - 60, 240 - 70, $"W: {w_}\nH: {h_}", -1, -1, -1, -1, 1);
	draw_sprite_ext(sonic_no, anim, 320 - 60, 240, scale, scale, 0, -1, 1); //Collage sprite with different width and height
} 
if ( sonic_yes != -1 ) {
	var w_ = sprite_get_width(sonic_yes) * scale, h_ = sprite_get_height(sonic_yes) * scale;
	draw_text_color(320 + 60, 240 - 70, $"W: {w_}\nH: {h_}", -1, -1, -1, -1, 1);
	draw_sprite_ext(sonic_yes, anim, 320 + 60, 240, scale, scale, 0, -1, 1); //Collage sprite with same width and height
} 

var w_ = sprite_get_width(sonic_normal) * scale, h_ = sprite_get_height(sonic_normal) * scale;
draw_text_color(270, 420, $"W: {w_}\nH: {h_}", -1, -1, -1, -1, 1);
draw_sprite_ext(sonic_normal, anim, 220, 240 + 60, scale, scale, 0, -1, 1); //Sprite added with sprite_add, different width and height

var w_ = sprite_get_width(sonic_normal2) * scale, h_ = sprite_get_height(sonic_normal2) * scale;
draw_text_color(370, 420, $"W: {w_}\nH: {h_}", -1, -1, -1, -1, 1);
draw_sprite_ext(sonic_normal2, anim, 340, 240 + 60, scale, scale, 0, -1, 1); //Sprite added with sprite_add, same width and height

Image

Expected Change

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions