D
deciduous
Guest
Hello all!
I'm currently working on an android project that involves some use of the draw_sprite_part method. It's all working really great on my computer, but I have a small annoying issue when I run it on my android tablet or phone.
Some Context: The game involves usable inventory items that charge over time, and I'm using draw_sprite_part to draw the selected inventory item sprite over the character. In order to display the charging effect I draw the first sprite with 0.25 alpha and the other with a value of 1. Over time the 0.25 alpha image shrinks and the other grows until it's fully charged and you have a full, non-transparent sprite hovering over your player.
The Problem: When this is run on my android device I get a strange effect where, below the inventory sprite and over the player object, is a piece of a totally separate instance sprite that disappears at the same rate as the inventory sprite charges. Again, this is a non-issue on my PC.
Here are images of the issue in game:
PC version doing just great.
Android version struggling with life.
Here is the code in which I draw the sprites:
I have tried cleaning the asset cache, restarting GM, reconnecting my tablet, and testing on a different device. Nothing has working so far.
Has anyone had an issue that sounds at all like this? Any help would be appreciated.
Thanks!
I'm currently working on an android project that involves some use of the draw_sprite_part method. It's all working really great on my computer, but I have a small annoying issue when I run it on my android tablet or phone.
Some Context: The game involves usable inventory items that charge over time, and I'm using draw_sprite_part to draw the selected inventory item sprite over the character. In order to display the charging effect I draw the first sprite with 0.25 alpha and the other with a value of 1. Over time the 0.25 alpha image shrinks and the other grows until it's fully charged and you have a full, non-transparent sprite hovering over your player.
The Problem: When this is run on my android device I get a strange effect where, below the inventory sprite and over the player object, is a piece of a totally separate instance sprite that disappears at the same rate as the inventory sprite charges. Again, this is a non-issue on my PC.
Here are images of the issue in game:
PC version doing just great.
Android version struggling with life.
Here is the code in which I draw the sprites:
Code:
draw_self();
if(current_item == "rock")
{
if(!charged)
{
current_cool = alarm[0];
image_mult = current_cool / cooldowns["rock"];
charge_line = sprite_get_height(spr_rock) * image_mult;
draw_set_alpha(0.25);
draw_sprite_part(spr_rock, 1, 0, 0, sprite_get_width(spr_rock),
charge_line, x - sprite_get_width(spr_rock) / 2,
y - sprite_height - sprite_get_height(spr_rock) / 2);
draw_set_alpha(1);
draw_sprite_part(spr_rock, 1, 0, charge_line, sprite_get_width(spr_rock),
sprite_get_height(spr_rock), x - sprite_get_width(spr_rock) / 2,
y - sprite_height - sprite_get_height(spr_rock) / 2 + charge_line);
}
else
{
draw_set_alpha(1);
draw_sprite(spr_rock, 1, x, y - sprite_height);
}
}
else if(current_item == "bear trap")
{
if(!charged)
{
current_cool = alarm[0];
image_mult = current_cool / cooldowns["bear trap"];
charge_line = sprite_get_height(spr_bear_trap) * image_mult;
draw_set_alpha(0.25);
draw_sprite_part(spr_bear_trap, 1, 0, 0, sprite_get_width(spr_bear_trap),
charge_line, x - sprite_get_width(spr_bear_trap) / 2,
y - sprite_height - sprite_get_height(spr_bear_trap) / 2);
draw_set_alpha(1);
draw_sprite_part(spr_bear_trap, 1, 0, charge_line, sprite_get_width(spr_bear_trap),
sprite_get_height(spr_bear_trap), x - sprite_get_width(spr_bear_trap) / 2,
y - sprite_height - sprite_get_height(spr_bear_trap) / 2 + charge_line);
}
else
{
draw_set_alpha(1);
draw_sprite(spr_bear_trap, 1, x, y - sprite_height);
}
}
draw_set_alpha(1);
Has anyone had an issue that sounds at all like this? Any help would be appreciated.
Thanks!
Last edited by a moderator: