

To make gravity we need to add a change Y Velocity by block and put a negative number in (so the sprite goes down the screen). This is because Y Velocity stays at zero. You probably want to attach a when green flag clicked block on top of this. We want the y position of the sprite to change by its y velocity every frame.

Basic Physics in ScratchĬreate a sprite for the object you want to fall (or use one you already have).įirst, we will need to create a variable for the current velocity of the sprite. The earth will always be at the bottom of the screen. Most gravity will come from the earth - so we will ignore other objects. If you have an apple and you drop from high up what happens? Well the speed (or velocity) of the apple increases towards objects exerting gravity - in proportion to mass - until it reaches terminal velocity or hits something. Please help.To create gravity in scratch we first need to understand how gravity acts in the real world. It feels like it should be not so complicated but i cant achieve the desired effect. But then i cannot register when the player is colliding with it. I tried to play around with the layer Matrix - to make the coin only be affected by ground layer for instance. If you make boxcollider "isTrigger" the coin will just fall.

I want the coin just to dissapear when player hits it. The coin works like an obsticle and i dont want that. For instance if my character is in the air and hits the coin it will break his momentum.

When my player hits the coin he kind of bumps into it. The coin have both rigidbody2d (in order so that i can use addforce and bouncing and stuff) and Boxcollider2D (so that it will not just fall through the ground and so that it can be detected by player etc). I could achieve that, by adding force the the coins when they are created. But i want the coins to kind of splash out of the chest. I want to create chest that spits out coins when i hit it. Searched everywhere, but couldnt find the answer. Hey all! I have been trying to solve this for a day now.
