Hi everyone, so I'm making a simple homage to Kung Fu Master and while it's not done of course, I'm working on a system that allows enemies to randomly come from the left and right. I have a few variables I was using to help manage the game's controllers and applied this same approach fairly successfully with the enemies as well, but they show a strange behavior and I'm not sure why:
swipe left and right to move.. swipe up to jump and tap to stop.
this is where i'm determining the bullet speed of the enemies.. i have a left enemy and a right enemy just to help keep things easy to manage.
so the idea is that if the player is in a moving right state, the left enemy bullet speed gets reduced and the right side goes faster.. and overall this works fine moving left and right, but when idle.. where i have both off thus making the speeds normal (400 and -400 respectively) things get weird.
I don't get why. there are no other places in the game where bullet speed is changed. regardless if i set the bullet speed to all enemies to 0 or 400 / -400 (respectively again) the right guy continues to be in that stuck state..
I wonder if it's something about using the (-) symbol in the formula, but all of my testing has been unable to find some common thread. Maybe it's something about using - and another - or something? like dividing by 0