Table of Contents

set velocity to vx () vy ()

Description

The block sets the velocity of the sprite to the defined values in the x and y directions.

Example

The example demonstrates the ball falling in gravity in a box. Using the pen extension we are also tracking the trajectory of the ball.

The example demonstrates the ball falling in gravity in a box. Using the pen extension we are also tracking the trajectory of the ball.

Read More
In this example, we will analyze the effect of the bounce property of the sprite using a ball. We will track the ball using the pen extension and the color will change with the y velocity of the ball.

In this example, we will analyze the effect of the bounce property of the sprite using a ball. We will track the ball using the pen extension and the color will change with the y velocity of the ball.

The coefficient of restitution is the ratio of the final to the initial relative speed between two objects after they collide. In PictoBlox it is controlled with bounce property. It varies from 0 to 100%.

The following is the code we will use:

Let’s see how the code work will various bounce values:

  1. Bounce = 10
  2. Bounce = 60
  3. Bounce = 70
  4. Bounce = 80
  5. Bounce = 90
  6. Bounce = 99

Earth vs Moon

If we change the gravity with a bounce value equal to 90, we can simulate how the ball will work on the moon.

Read More
In this example, we are making a rocket shoot bullets to the mouse pointer when the space key is pressed. 

In this example, we are making a rocket shoot bullets to the mouse pointer when the space key is pressed.

Rocket Script

Bullet Script

Output

Read More
All articles loaded
No more articles to load