Changing Animation through the use of variable

Im making a gacha like mechanic through the use of animation, And It only shows the fish(the default image of the object) Ya’ll know the problem?

Well… the animation you’re to saying to show, is just same animations. Nothing is being changed or added. You’re not changing the animations they are just on 1 style. You just changed the variables but not the animation

2 Likes

In the screenshot, I don’t see anything that swaps the animation,maybe you forgot to include it.

I mean how do you change/modify the String “SelectedPet”.?

Place text object in your scene and in events change its text to SelectedPets

Also are you changing animations by name or by numbers?

1 Like

1 - roll random number
2 - select by that number child var from array
3 - change animation

1 Like

Yes… I mean… shouldn’t the string change also be visible in the screenshot? Because if there are no errors and nothing changes, it might be that he forgot to do it.

edit:oh wait ive seen the var now.

at this point i dunno, maybe i would try to subtractMoney as last subevent…
bcs if money=1 he subtract 1 before subsequents conditions…
it’s what i would try to debug…
…and promoting roll var checks as main conditions not as subevents…

1 Like

GDevelop is case sensitive, so can you confirm the animation names are spelt exactly as they are entered into the arrays? So camel case with no spaces between the words?

Better still, can you screen shot the animations for the Pets sprite object?

1 Like

@RMDB @MrMen
Like i said
Text object and let’s print what he is changing to
Cause to me it looks like either he is addressing something wrong
Or animations do not match variable values

So actually MrMen had better idea to also check animation names
But then aside from text object showing what variable values are
Screenshot of arrays would make more sense

Thanks for replying y’all @ZeroX4 @Da-Just @MrMen @RMDB, I got it right now. I just needed the animation to become the same as "Rarity"Pet[PetIndex],… The only problem now is the animations have different widths and heights

Idk how to fix their sizes, when theyre just different animations

1 Like

i would define a proxy sprite to use for all animations.
then (with the same origins setted) in events resize all the sprites (the pets grp) to the proxy one. bcs it seems you have various size…they gonna results scaled btw

should i do that with the condition at the beginning of the scene right?, also ik im dumb but yk what action is that?, thx for helping btw, appreciate it

There is action to change position of object

And there is action to change CENTER position of object
So i would change their animation and in next action under it change their center position

BUT idk if that is exactly what you are asking for?

nope.

if they’re not, crop your sprites to content first. like in gimp > image > cut to content…save all your new sprites

then.
in gdevelop

create a proxy sprite with desired width and heght.
place the proxy where u want the pets objects to appear

then

action
change pets position to proxy.X() , proxy.Y()
change pets width to proxy.Width()
change pets height to proxy.Height().

this way the gonna all looks the same size of the proxy,but if it’s not what you want, you can skip the resize (width , height part).

Oh OKI THANKS
you all really helped a lot

I mean just the same size for all the sprite animations

then in action list there is change width , height , or size for grp objects.

hmmm thanks for info again!
damn i talk like ai

RMDB gave you events solution to your issue
But quality wise it won’t be perfect cause it will deform a lot of your images

Most sense would be to resize/re draw + resize your images in some image editor

Yeah i know what you just felt reading it
Welcome to game dev world

2 Likes

ts hard for me fr damn