spawning too many actors on collide
Hi everybody,
I have a bug on the game I'm working on I can't understand. Check the screenshot here:
When I tap on the screen, the mouse stand still and everything moves down of a certain amount of pixels on every tap (I used an interpolate on the Y position to move things down).
When an obstacles (in this case the paws you see on top) collide with the red line a new obstacles is spawned on top of the screen.
During the game the character changes its size (getting bigger), so I need to have more space between obstacles as the game goes on. To do this I constrain the red bar Y to 3 times the character size starting from the top of the screen. So if the character is 30 in the beginning, the bar on top is 90 from the top edge of the screen, so the distance between obstacles is 90. When the character is 40, the distance is 120 and so on...
This works perfectly. But sometimes, after a while I'm playing and maybe (not sure if that's the cause) when I tap faster, I get two obstacles really close one to the other or even overlapped.
How's that possible? There's just one collider, it's like it detects the collision twice or something.
Can this be because I use an interpolation to move things? I can try using a change attribute instead, as a test.
Any ideas?
THANKS!
PS: in the real game the collider red bar is 0 px tall, I made it bigger just for the screenshot.
Wonder Maru: casual games for casual people. www.wondermaru.com
Comments
Because you are using a interpolate. What amount of time are you using? Set the time to .03 this is one code cycle.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I'm using 0.1 currently. I didn't know I could use time shorter than that. I'm gonna try 0.03 as suggested, thanks!
Wonder Maru: casual games for casual people. www.wondermaru.com
ok, yes, it's better. It happens if I really clik/tap like a mad. The only thing is now the movements are less smooth of course. I'll tweak the value to find a good compromise.
If there's another solution I'm very open to try it
thanks a lot!
Wonder Maru: casual games for casual people. www.wondermaru.com
A code cycle or code scan happens every .03 seconds so that is the floor for any time really. Try setting the interpolation to ease in/out.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
you just gained a new subscriber on your youtube channel by the way
Wonder Maru: casual games for casual people. www.wondermaru.com