ctmatthews

Indie game developer

a trans woman in the UK making 2D action games about ducks:

Ducky's Delivery Service (Steam/itch/Switch)

Chessplosion (Steam/itch)


i mostly post on my Blog / Newsletter / Patreon


i play fighting games! i won Evo in 2021.


pfp/header by NomnomNami


πŸ“° Blog
ctmatthews.com/blog
πŸ’Œ Newsletter
ctmatthews.com/newsletter
βœ‰οΈ Contact (email/DM)
ctmatthews.com/contact
πŸ’» itch.io
ctmatthews.itch.io/
🐣 Patreon
patreon.com/ctmatthews
πŸ–ΌοΈ pfp/header by NomnomNami
nomnomnami.com/

nomnomnami
@nomnomnami

it's actually pretty fun and easy to add a bit of polish to your games!! in Starry Flowers, i made it so characters slide+dissolve in when they're shown... it's a little fancier than just showing a character with dissolve, but not so fancy that i'd tell beginner devs not to even bother.

the code for it looks something like this:

transform appear_right:
    xalign .85 yalign 1.0
    alpha 0 xoffset 30
    easein .5 alpha 1.0 xoffset 0

ok, what are all these things doing... let's start with align*. that's just where the image is on the screen--85% of the way to the right, and 100% to the bottom. alpha is the transparency, and xoffset is moving it 30 pixels over from where it normally would be. (for xoffset, positive numbers go to the right, and negative to the left! i can never remember which way is which, so don't feel bad if you forget too.)

*SIDE NOTE: feniks wrote a really in-depth tutorial explaining this property better (among others), and actually recommends using different properties other than align if you're not setting it to `0.5` or `1.0`... but for the purposes of showing a character on screen (where it doesn't need to be in a SPECIFIC place), i think it's more straightforward to just go ahead and use align. definitely keep in mind that it's not always the best property to use tho!!

now for the actual ANIMATION part! that's the easein .5 bit. you can swap it out for linear or easeout or lots of other easing functions! i mostly use those three though, so definitely don't worry about memorizing them all. you can change the number to however long you want the animation to last (half a second was good enough for me!)

everything after easein is where we want the displayable to be when the animation is done. so in this case, alpha at 100% (in other words, fully opaque), and xoffset back to 0. since it's going from 30 to 0, the character moves to stage left! (gee this explanation took longer than expected, i hope it all made sense...)

ok so now in your script, all you have to write to use your new transform is:

show character at appear_right

WHEW... that's not so bad.

the one thing to remember about this one is that it's at instead of with! with is for transitions, which affect the whole screen. at is your transform buddy. cuz it shows your displayable at whatever properties you set... idk, that's how i remember it anyway.

you can apply transforms to ANY DISPLAYABLE!!!!! that means SCREEN ELEMENTS........ you can also specify different transforms for various conditions using the on statement. try setting up your own on hide animation for the example transform i just gave you!! all you have to do is write hide character in your script to see it in action (as long as you first showed them with appear_right, you don't have to specify the transform a second time).

sorry this tip was more complicated (or at least it feels that way???), if you don't feel confident enough to write your own, please feel free to copypaste the code blocks above and just use them as-is lol. or skip it entirely!! not all games need this!!!! i just think it looks nice :)


You must log in to comment.

in reply to @nomnomnami's post: