Can you make something throw without tapping buttons?


#1

I'm wondering how you can make a character throw an object without tapping any buttons. Is it possible?


#2

Hi @AwesomeGal1b, I hope this is what you mean:
You could make a character throw an object by tapping the character or swiping it in a certain direction. Or, by tapping the screen. This way you wouldn't need a button.
Tell me if this is not what you mean or if you have any questions! :grinning::wink:


#3

@Madi_Hopscotch_ I never thought about tht before, but I was actually thinking about making tht something throw automatically without tapping anything or touching the screen. It's kinda like playing a game against a computer where it automatically throws. Thanks for trying to help me. I appreciate it!:stuck_out_tongue_winking_eye:


#4

Oh, ok! There is way to automatically though an object with some coding. Would you like me to give you some ideas on how to do that or do you want to figure it out yourself?


#5

May you give me an idea? I'm not a great coder...


#6

I would love to give you an idea! I am sure your not a bad coder. Everyone has to learn to get better!

Here is and idea of how to make a character to automatically throw and object:

First, drag out a character (EX: Monkey) and also drag out a new text and set it to whatever object you want (EX: banana).

Now, create a new rule for banana and say,
When play button is tapped:
Repeat Forever:
Set invisibility to 100
Set position to X: Monkey x Y: Monkey y
Wait 1000 miliseconds (1000 m = 1 second)
Set invisibility to 0
Change x by: (Here you can put how far you want your our object to be thrown. EX: 500)

This is a picture of what the code might look like:

Visualize this in your head:

What the banana is doing is becoming invisible, then setting its position to Monkey. Next, the banana waits 1 second and then becomes visible and is being thrown in a certain direction. This is repeating forever.

Here is a link to my example project if you want to see what this looks like
http://c.hopscotch-staging.com/p/xfcxjg84y

I hope this helps and is what you are looking for!
Let me know if this was confusing at all or you have any other questions! :smirk::blush:


#7

Maybe you can.... See this
example: we want to throw this :hibiscus:

when the play button is tapped

Repeat forever

Wait ____ milliseconds
Change X by 100 (or -100)


#8

Thanks, @Madi_Hopscotch_ and @Queen152! Sorry for not replying earlier. I had to wait 22 hours. I just have one more question: can you make it so that your character will change x, throw, then change y in that exact pattern?


#9

@AwesomeGal1b You could use swiping, shaking, tilting, when Robo jumps, lots of other alternatives! :wink:


#10

Is this what you mean?

Visualize this example in your head:

MONKEY CODE:
Repeat forever:
Change x by 500
(Throw)
Change y by 500
(Throw)
Change y by -500
(Throw)
Change x by -500
(Throw)

If this is what you mean, the banana code would not need to change.
If this is not what you mean, please let me know!


#11

Thanks! That's what I mean.


#12

You can.
@anonymous second two year bump.