#I can't size my sprites properly
16 messages · Page 1 of 1 (latest)
There are two ways this question could go.
Either you wanna know how to resize sprites. That's simple. You simply go into the sprite editor for each object and resize them to all be the same size.
Or, if you really wanna be technical about it and are looking for an actual way to resize all of the sprites in the room with code when you boot up the game, you could make an object that's a parent to all the other objects in the room. Then make a for loop that goes through all the sprites in the room and looks for their sprite_width and sprite_height and adjusts the image_xscale and image_yscale accordingly. @somber sable
ok watch this
they are all the same size 32x32
it keeps getting squished when running
Do you have any code that would make it do that
anything involving image_xscale or image_yscale
var key_left = keyboard_check(ord("A"));
var key_right = keyboard_check(ord("D"));
var key_jump = keyboard_check(vk_space);
var move = key_right - key_left;
hsp = move * walksp;
vsp = vsp + grv;
//Jump
if (place_meeting(x,y+1,O_wall)) && (key_jump)
{
vsp = -7;
}
// horzontial
if (place_meeting(x+hsp,y,O_wall))
{
while(!place_meeting(x+sign(hsp),y,O_wall))
{
x+= sign(hsp);
}
hsp=0;
}
x+= hsp;
// vertical
if (place_meeting(x,y+vsp,O_wall))
{
while(!place_meeting(x,y+sign(vsp),O_wall))
{
y+= sign(vsp);
}
vsp = 0;
}
y+= vsp;
//Animation
if (!place_meeting(x,y+1,O_wall)) // note here: another colision check that we already did before is not optimal for performance
{ sprite_index = S_player_jump;
image_speed = 0;
mask_index = S_player_idle;
if (sign(vsp) > 0) image_index = 0; else image_index = 1;
}
else
{
image_speed = 1;
if (hsp == 0)
{
sprite_index = S_player_idle;
}
else
{
sprite_index = S_player_walk;
}
}
// flips the sprite based on which direction they are going
if (hsp !=0 ) image_xscale = sign(hsp);