I need some help with "bouncing" and "boomerang."

Basically, I’ve been messing with this program for a little over a week. I feel like I’m making good progress in learning it through. I had a couple different ideas that were ambitious for a noob and decided to start with something simple. That’d be mario. I’ve figured out a lot already but for the life of me I cannot figure out how to bounce an object using the bounce behavior. I’ve tried doing what the wiki said. Maybe I’m looking at it wrong. Can someone explain how do I bounce an object using the object behavior?

Also, what’s up with the boomerang? I couldn’t figure that out either.

Here’s a snip of how I use the bounce behaviour, bouncing the player off white blocks and applying a force in the direction the player is moving :

HTH

Thanks for the reply. I tried that but with no luck. I’m trying to make a block slightly bounce when struck from underneath. Like a Mario powerup block.

I’m trying to use tween now. I can get it to work if I put “trigger once” with the “bounceup tween is finished” condition but this stops it from happening to other blocks. Without the “trigger once” the block will not stop when returning to it original position.

Any suggestions?

Yeah, the bounce behaviour is the wrong thing to use here.

What is BrickHitBox? And why wait for Mario to fall? Why not check for a collision between Mario and PowerBlock while Mario is jumping (maybe check Mario is below the PowerBlock too)?

Why are you tweening 50 pixels up, but only 18 down?

And ideally you should delete the tween when it’s finished.

The “BrickHitBox” is a hidden object I have attached to Mario. I set it’s position to a point about a pixel above Mario’s center Y position and narrowed it to Mario’s head. So it allows me to have collision checks just for Mario’s heads and doesn’t affect Mario’s platform behavior. At first I had no other condition with it but I didn’t want him breaking blocks he was walking under. I think I used jumping first but it was giving me problems and falling seemed to work. I also didn’t want him breaking blocks when they were directly above him. So I set up a distance check between Mario and the block. It doesn’t recognize the event unless Mario is a full block away or crouched when Jumping.

And idk why I have the tween set up like that. I’m assuming it’s wrong but I can get it to work once with those settings. Having more than 18 down sends the block past its original position. I’m very confused about it because it seems like all my ducks should be in a row yet I’m running into issues like this.

That’s because the Y position of the object is at the top left, but you’re moving it relative to the Y value of the object centre.

Try tweening to PowrBlock.Y() + 34 and PowerBlock.Y() - 34

I used that point first but it was sending the block diagonally toward the origin point. It stays on its Y axis with the center point being used. But I’ll try again. Maybe I did something else wrong that time.

Weird. It worked the same as the setup I just had. But I’m still having the same problem. It works great the first time if I have “trigger once” in the condition but don’t work after that one instance. Without the “trigger once” the block does not stop when returning.

Because you aren’t deleting any of the tweens when they have finished. So GDevelop keeps firing off a BounceDown tween because the BounceUp tween has finished, and the condition will be true every time GDevelop runs the event, firing off the BounceDown tween repeatedly.

1 Like

Thanks. That was my problem. I kept trying to delete the tween with force actions. I did not realize there was actions specifically for removing tweens.

Thanks for the help the other day. I got if all worked out. But now I’m trying to bounce the player off an enemy and I figured I’d try this bounce extension.

I see you’re adding an instant force to Variable(PlayerAngle). I’m assuming that’s a scene variable and it’s originally set to 0? But the force you’re adding is another variable called PlayerForce. I’m not sure what that is. If that’s a scene variable, what should it be set to? And then you change PlayerAngle = Player.ForceAngle. is that another variable?

Sorry. I’m just really confused about this whole bounce thing.

I’m going to be pedantic here and say I’m applying an instant force at the angle held by PlayerAngle on the Player object :grimacing:

PlayerAngle is the angle of the player’s movement, and originally is set to whatever direction the player is initially moving. When the bounce behaviour is applied, I reset PlayerAngle to the new direction of the Player object, after it’s been calculated by the bounce behaviour.

PlayerForce is the force applied to the player. In my actual game this reduces over time (to simulate friction) and so the player slows down.

ForceAngle() is a GDevelop function on an object that gives you the angle of the current force applied to it. It’s not the force angle of the Physics behaviour, but the angle of the force that has been applied to objects without the Physics behaviour.

Hope this explains things a bit better.

1 Like

It does. I appreciate it.