How to do simple ball bouncing

hopscotch
help
helpwithcode
#1

#Howdy! I be Nindroid Games™ and I’m going to show you how to do simple ball bouncing.
Very simple. Like, VERY simple.
Yes, I did search before I posted.
First, you need a ball. So add whatever you want. I’m going to use a Hopscotch circle.

Next, I will add what it’s going to bounce off of.

Ok. So, put the platform in the bottom middle, and the ball above it. Now, let’s add some code to the ball.

When game starts
Repeat forever
Change Y by A variable
Increase Same variable by -1

But it never stops bouncing?!

Why it never stops bouncing

You most likely already know this, but it constantly keeps falling faster because it doesn’t change the variable when it hits the platform.

So, let’s add another new rule.

when self bumps platform
Set same variable again to random 10 to 15

Okay. Now let’s test it!

It works! Yayyy!

How it works

In the first when, it is constantly changing y by a variable, and decreasing that variable by one. Meaning it goes downward, while accelerating.

In the second when, it bounces by setting the Y variable to any number between 10 and 15. And because it’s changing it’s Y by that, it goes up. And that’s how it bounces.

I hope you enjoyed this! Maybe learned something, but probably not.
Even though it’s not realistic, it’s good enough for Hopscotch.

tag list

List (112 tags)
@BB-Box
@Allyb
@Artistic_cat
@ArtyAnimal
@AvocadoDont
@AwesomeNachos
@Awesome_giraffe
@BaconStudios
@BerryFOX
@BlastFusion
@blog
@BubblegumCupcakeMix
@ButterBark
@celine
@ChocolateFox
@CodePerfect
@codingkit
@ColourfulBlack
@ConnellCoder
@CreationsOfaNoob
@cupcakemaniac1
@Cutedolphin
@danaball20
@DatKawaiiPillow
@DECODECO
@DiamondDragon
@diss_track_queen
@DMF
@DragonMc
@Dylan329
@EmojiArts
@EmojisRUs
@Explorer_
@ExquisiteSoup
@FascinatingTreehouse
@FluffyMarshmellow
@FoodDelivery
@FreshGuppy
@FunkyGoldfish
@GiraffeProductions
@GLaDOS_On_Da_Forum
@Goobrgrlrye
@gryphonroadblocks
@happy12345678910
@HappyPerson
@Himynameismeredith1
@Houseelf87
@HRR1213
@IKeudin
@ILoveFashion12
@Jess888
@Jojo
@JonnyGamer
@KawaiiHotDog
@kenlauescuadro
@KoolM123
@Kosho
@kubajr
@KVJ
@LavenderArts
@LegendOfFriday
@laser_eyed_puppy
@Mei-The-Riolu
@MiNi
@Mothwolf
@Mr.rex
@Murphy1
@NeoPixel
@NindroidGames
@Paige1212
@Paydent12
@PerfectPanda24
@Periwinkle_Dolphin
@PianoGorilla2006
@PIANOMAN
@Pink_Roses
@Potter_Head
@PumpkinGirl
@Puppylulu
@PurpleStorybook
@Rainboom
@Rider
@RubyStars
@RubyWolf1
@ScarySweetheart
@Sensei_Coder
@shamrockcat
@Silverdolphin
@Skyarmygenral
@SnowGirl_Studios
@sophia71205
@StarKid
@StarryDream
@Steelhooves
@StRiKe_Charler123
@Strongerthanyou
@Sugarisyummy
@Sweater
@TACOCODE
@treefrogstudios
@TrevCoding
@UnderagedCoder1
@Valgo
@ValueGamesStudio
@Vortex.inc
@waddlemarco
@WasIdealessHere
@WhiteFeathers
@William04GamerA
@Work_kids_coding
@Yellow_Mellow
@YuxinaYammy
@Zachyswag
Get the latest list here: http://forum.gethopscotch.com/t/official-mass-tag-list-omtl/16843

27 Likes
#2

Thank you
How did you make this?
By gifs?

4 Likes
#3

I know how to do this from another different project, but this is cool, though.
points for uniqueness, no points for originality...

3 Likes
#4

Ive made stuff like this before but i like it

1 Like
#5

Amazing tutorial!

omg GIFs!

2 Likes
#6

Can you stop saying everything is unoriginal and acknowledge great work?

3 Likes
#7

I do acknowledge great work, but I also like originality!

4 Likes
#8

Yeah well you always say that things are unoriginal. Stop sayi that because it could hurt the makers feelings.

6 Likes
#9

No flame wars plz

3 Likes
#11

Cool!
I promise, I'll never say anything about originality ever again.
Except if it is original.

3 Likes
#12

I made the gifs by recording Hopscotch (only on newer devices) editing it (in iMovie, because the video editor that can edit straight to a GIF is on my phone.) and made it into a gif.

4 Likes
#13

Cool tutorial! Did you learn it from my "Smiley Bounce"? Just asking! :smiley_cat:

2 Likes
#14

Nope.

2 Likes
#15

Amazing tutorial! It´s easy to follow and the gif-animations are so cool (I guess that you used gif-files to make the image move).

2 Likes
closed #16
archived #17