Discuss Scratch

ikuzduy
Scratcher
100+ posts

How do I make a floating button in the easiest way possible?

How do I make a floating button in the easiest way possible? (and smoothest)
Thanks
Mechanical_coding
Scratcher
44 posts

How do I make a floating button in the easiest way possible?

you said easiest way so…

make a sprite that has a button on it
then code this:
whenclickedforevergotofrontlayerwhenthisspriteclickedbroadcastclicked
legendary34678
Scratcher
1000+ posts

How do I make a floating button in the easiest way possible?

By “floating” I assume you mean moving up and down smoothly. You can use the sine function for this. Not sure if you've learned about it in math yet, but simply, sine is a function that oscillates smoothly between -1 and 1 which you can use to create a bobbing effect.
RadiusGames46
Scratcher
100+ posts

How do I make a floating button in the easiest way possible?

Alright.

whenclickedsetsizeto0% Some code below will make this pop in.showforevergotox:desiredxy:sinoftimer*100*5+desiredy Bobbing effect.setsizetosize+100*.5% Smoothly move the size to 100.iftouchingmouse-pointer?thenchangesizeby15 Increase size on hover.ifmousedown?thenbroadcastpressed Button was clicked, so begin any other code.hidestopthis script Stop the code. If you want it to continue, remove this block and the hide block.
Hope this helps!
alisonw778
Scratcher
9 posts

How do I make a floating button in the easiest way possible?

Thanks! This really helped! Follow from me.
samululas
Scratcher
2 posts

How do I make a floating button in the easiest way possible?

whenclickedgotox:0y:0foreverpointindirectionsinoftimer*400+specificdirection

Last edited by samululas (Nov. 17, 2023 15:15:02)

Powered by DjangoBB