kaplayjs / kaplay

🦖 A JavaScript/TypeScript Game Library that feels like a game. Make games fast, fun and fanstastic.
https://kaplayjs.com
MIT License
392 stars 31 forks source link

feat: shake() function for sprites #281

Open candycarmel opened 1 month ago

candycarmel commented 1 month ago

there is camera shake however, i think a sprite shake would be useful aswell

a shake function for the (sprite component? really anything that can be drawn)

you would use the function with an intensity parameter, and an optional duration parameter, and the sprite would then shake back and forth without changing the transform of the area

giving all other objects a fixed() component and then doing camShake()

I'm not sure if the duration parameter would be necessary.

amyspark-ng commented 1 month ago

this is a cool idea, could make it like only shake X axis or Y or both, about the duration it could use the same parameters as the improved shake i suggested