Hi guys, this is my question regarding physics
im trying to make my hero in a vertical scroller game to try to stay inside the screen.
So i created 2 listeners, one that checks if hero is hero.y < 200 pixels ( top red part) and hero.y >500 (top bottom part) and when they are inside i apply some gravity scale to make them go back up/down, the idea is for the hero to float with some vertical movement but without exiting the screen. After i tried doing this the hero will suddenly get out of control with the gravityscale.
Any idea how i can achieve this? Sorry still learning.