![]() Let’s say when the thing collides it stops. ![]() Create another sprite or colour for the object to collide with. Set to ((Y Velocity) * (-8))Īnd finally, there is collision. We will add this code into the forever loop. For this I just set Y Velocity to 80% (multiplied by 0.8) of what it was. ![]() Things also slow down due to air resistance. 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. ![]() To create gravity in scratch we first need to understand how gravity acts in the real world.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |