How might I make a pinball-style bumper?

Hi Everyone!

I’m trying to make some pinball-style ‘bumpers’ on a top-down game. The idea is that, when the player character moves into them from any direction, they’re momentarily fired off in the opposite direction.

Using [collision ‘bumper’>number>impulse] I’ve managed to set it so that hitting the bumper in any direction should trigger an impulse in the opposite direction. Now, it works if you hit the top or bottom of the bumpers and the player sprite springs up or down as intended.

However, colliding with the blocks from the left or right doesn’t trigger the same response - the character sprite is just stopped as if it’s a static block. If you collide with the block from left or right, then move down and back up again (so ‘brushing’ the bumper on the left or right), the bumper works as intended, but only when you’re NOT pressing left or right.

I’ve also tried turning the bounce level up on the bumpers instead of using [Collision>Impulse] but the same thing happens.

Any pointers would be greatly received! Thanks in advance!

You can find the game here: Flowlab Game Creator - Bumper Test

2 Likes

This would involve some very complex physics. I’ll look into it in depth later, then try to give you an overview :slightly_smiling_face:

Thanks! Any advice would be great :slightly_smiling_face:

So, when you flip the player character it flips the direction of the impulse. Make sure you’re not using flips on the character for side to side movement.

Thanks for the reply here - I did have a sprite flip on the movement bundle, so I just tried removing that and the problem was still occurring… :confused:

1 Like

Hmm. One easy solution is to disable manual movement when hit and set bounce up to 50 or 100, but if you don’t want every single block to be bouncy, or you don’t want to waste hours coding individual blocks, then you’ll have to troubleshoot. Just so you know, velocity blocks override bounces, so if the keyboard blocks are on repeat, it’ll continue moving the direction of the velocity without being affected.

2 Likes

This actually solved it! I turned off the repeat on the keyboard blocks for movement and it’s now working really well, thanks! I thought that repeat would need to be on so that it didn’t register it as one button press and only move the character once. I just checked and repeating was not on for up/down so that’s why vertical bounces worked but not horizontal.
Thanks for your help!

3 Likes

No problemo. I assumed that since you probably took it from the Run & Jump bundle, which has repeating keys for left and right. Glad I could help! :slight_smile:

1 Like

Just so you know, velocity sets the velocity. Unless there’s friction, gravity, or something else slowing the velocity down, velocity acts like it’s in space. Which I used to make a spaceship style movement game.

1 Like

You’re right, I did take it from the run and jump bundle! I’ve also got it set so that any direction key up resets the velocity to 0 in both axes. Prior to doing that the sprite was definitely very floaty… Now I’ve got to work out how to make some pinball flippers… (which will possibly result in another forum post). Thanks again for your help!

3 Likes