How to throw an object

Hello all,
I’m new to Hopscotch forum but I want to learn how to make a character throw an object. I’ve watched some youtube videos but they are dated and the blocks are now different. I want a character to throw a baseball when I click on it.

Any help would be appreciated.

15 Likes

hey, you can mess up with Xmove and Ymove by using this code:

When game is playing
Increase Ymove by -0.7 //Feel free to change this value depending on what you are coding
When game is playing
Set Xmove to Xmove / 1.05 //Feel free to change this value depending on what you are coding

When game is playing
Set position to SelfX+Xmove; SelfY+Ymove

scrollable left to right

this will create very smooth movement. If you want the ball to move up right when an event happens, you can add this to your code:

When //event
Set Xmove to 4 //Moves the ball to the right
Set Ymove to 3 //Moves the ball up

//You can of course change these values depending on what you are coding :)

scrollable left to right

Hope this helps! tag me for anything, and welcome to the forum :)

4 Likes

I made a project of throwing
Here
(Hope this helps)

1 Like

Can I see the code for the game?

2 Likes

if you click on the link and then the “edit” button in the top right, youll be able to mess around with their code :))

2 Likes

Or, if you don’t see an edit button, try copying the link url and pasting it into the app search bar. The project should come up and youll be able to edit the code by tapping the small pencil icon in the top right corner of the screen after opening the project!

2 Likes

waittt did that change?? i don’t think that’s ever worked for me before lol

3 Likes

bump

1 Like