Keep sprite at custom size?

I’ve put some sprites in and set a custom size. When I playtest the sprites show up as their original size. How do I keep the custom size when the game is played?

If you set width/height in the editor it will be shown at that width/height unless you delete the sprite added in the editor.
If you’re creating the sprite from event you need to set width/height in events because the runtime always create the sprite at his original size.

Suppose you create a bomb to 32x32 pixel that’s the original width/height of the Sprite, later in the editor you set that bomb to 48x48 at the time you run the game that bomb will be 48x48 but if you try to create another from the event that new created bomb will be 32x32 unless you change the width/height in events.

1 Like

Have you checked this?
image

Mix that is auto-checked when you resize any object in the editor.

Are you trying to say Mixen?

Not if you resize it from the Object Properties.
image

Yes, I have checked the custom size box. That seems to work for sprite that needs to get bigger, getting smaller seems to be the issue.

mgregsim

Can you show examples of this, say maybe as a few screen shots?

Screen shot - work page

playtest page

Interesting. I’ve created a small project and I can’t replicate the issue. I’ve got a sprite I’ve reduced in size, and it stays that size.

Do you have any behaviours or effects attached to the sprite, any extensions in the game or any layer effects? Are there any events that perform any actions on the images, particularly their size? Are they anchored? Do you do anything like resize the scene?

And if none of those apply, can you create a single scene project and reproduce the issue?

I know, it’s really weird! This is the first time this has happened.

The “Level Number Buttons” have the behavior Tween assigned to them. When they are double-clicked they change the scene. When the mouse goes over them they grow in size 20% and back to original size when the mouse is off them. That is all that they do. No extensions or layers.

I decided that it was faster to simply remake the buttons at half size and that allowed me to fix the colors, too. If I get bored tonight (I have autistic children, so, ha! I’m never bored but often sleep deprived) I’ll try to recreate the effect in a single scene.

Do some basic check:
Are you creating the same button in events?

  • if no ok, if yes that’s why all others did not keep the custom size.

Are you changing the size of the button in events?

  • if no, then this is weird, if yes that’s why all other buttons are resized.

This will be the issue. I’m guessing that the events are being kicked off when the game starts, and resets the images to their normal size (are you tweening to a scale of 1?)

If you don’t resize the button images to half size (not in the GDEvelop editor, but the actual file), then as an alternative you could capture the button scale into a variable at start up (in an “At the beginning of the scene” event), and then use that value when you scale back and forth.

Yep, you were right! The Tween appears to deal only with the original size of the object rather than the custom size. I could have fixed it by changing the proportions in the Tween definitions.