Ask the VB master how to make the ball move around the arc?

Updated on delicacies 2024-04-01
13 answers
  1. Anonymous users2024-02-07

    Use the timer control to change the location of the jerry every once in a while.

  2. Anonymous users2024-02-06

    Graphic image class Afraid to take points and leave.

  3. Anonymous users2024-02-05

    New project, 1 timer1, 1 shape, ** as follows:

    dim i%

    private sub form_load()with shape1

    shape = 3

    backcolor = vbred

    backstyle = 1

    height = 500

    width = 500

    end with

    i = 0 true

    end sub

    private sub timer1_timer()if i = 0 then

    if = - then i = 1

    elseif i = 1 then

    if = 0 then i = 0

    end if

    end sub

  4. Anonymous users2024-02-04

    Required controls: shape1, timer1, command1, command2

    dim degree as single

    const pi =

    dim v as integer

    dim r as single

    private sub command1_click()

    falseform_load

    end sub

    private sub command2_click()

    trueend sub

    private sub form_load()

    3= false

    rnd rnd

    degree = 2 * pi * rnd

    v = 150

    r = 1 "The end"

    Get started"end sub

    private sub timer1_timer()

    if > 0 and > 0 and ( and ( then

    sin(degree) *v * r

    cos(degree) *v * r

    v = v * r

    else false

    call chagestate

    end if

    end sub

    public sub chagestate()

    if <= 0 or ( = then

    degree = 2 * pi - degree

    if <= 0 then = 1

    if ( = then = - 1

    end if

    if <= 0 or ( = then

    if ( = then = - 1

    if <= 0 then = 1

    if degree < pi / 2 then degree = pi / 2 + degree

    if degree > pi / 2 and degree < pi then degree = 3 * pi / 2 - degree

    if degree > pi or degree < 2 * pi then degree = 3 * pi - degree

    end if

    v = 150

    trueend sub

  5. Anonymous users2024-02-03

    'A timer control.

    x0 and y0 are the coordinates of the circle.

    r1 and r2 are the horizontal and vertical increments of the circle.

    private sub timer1_timer()static x0 as integer, y0 as integer, r1 as integer, r2 as integer

    x0 = x0 + r1

    y0 = y0 + r2

    if x0 > 50 then

    r1 = -30

    elseif x0 <= 50 then

    r1 = 30

    end if

    if y0 > 50 then

    r2 = -30

    elseif y0 <= 50 then

    r2 = 30

    end if

    x0, y0), 100, vbblueend sub

    Happy studying.

  6. Anonymous users2024-02-02

    The animation made directly with VB is not actually an animation but a continuous draw of different images on the form.,It feels like it's moving when you look at it with the naked eye.,Besides, the animation flashes and flashes to indicate that the time you set is too big.,Set a small point.,Let's talk about it.,If you use an ordinary monitor, it still has a refresh rate.。

  7. Anonymous users2024-02-01

    What controls are used to do it?

    Set the form's autodraw property to true

    The control's is also set to true (if any).

  8. Anonymous users2024-01-31

    You'll have to put the program up, and if the ball is running for too long, it will flash.

  9. Anonymous users2024-01-30

    The movement of the ball in the VB is actually a continuous sequence of individual frames.

    You try to make the intevel in the timer widget smaller or make the move value of your ball smaller.

    In short, it's okay to make your eyes feel like it's moving.

  10. Anonymous users2024-01-29

    You use a timer to control the movement of objects, right?

    It would be nice to make the timer interval larger.

  11. Anonymous users2024-01-28

    Don't judge in advance when there is a collision, and then direct the ball to automatically change its motion when the time comes.

    Just given the step size, traverse to determine which balls will touch at the beginning (or end) of the step, and then let the colliding balls start the next motion at a new speed according to the physics of collision. Then continue for one step to start judging the next point in time. In this way, the balls collide and move.

    In the actual coding, the object-oriented method and the appropriate variable step size technology can make the multi-ball collision coding simplified and the calculation smoother.

    Another: I don't know if there is a better way to judge the collidability under the condition of not knowing the situation around a ball at all, except for traversal, and the passing master can point it out.

  12. Anonymous users2024-01-27

    To be object-oriented, build the object of the ball. One instance and one ball. Each runs in its own thread. What happens in the event of a collision, let the ball figure it out.

  13. Anonymous users2024-01-26

    Straight reciprocating requires two commands, a timer, and an lable control with the interval property of 1 or custom. Polylines and curves need to define their own equations.

    dim step as integer

    private sub command1_click()= true

    end sub

    private sub command2_click()= flase

    timer1_timer 'Changed to

    end sub

    private sub form_load()step = 1

    end sub

    private sub timer1_timer()+50 * step

    if + then

    step = 1

    elseif < 0 then 'Change to less than zero.

    step = 1

    end if

    end sub

Related questions
19 answers2024-04-01

Hello friend, first peel and slice the small pumpkin, steam it in the microwave for 10 minutes, and puree it with a spoon. >>>More

15 answers2024-04-01

It's similar to a calculator.,Numbers can be entered on the interface.,You can also use the keyboard to enter.,Later dedicated**!! >>>More

10 answers2024-04-01

Experimental equipment: rectangular cardboard, candles, white paper, paper boxes, large sewing needles, iron clips, bottle caps. >>>More

13 answers2024-04-01

It's impossible.,It's still okay now.,You have to go to the farm to find a chicken.,Select.,And then keep hitting the chicken.,Wait for an exclamation mark to take the task.,There are task items that sell feed on nearby farms.,Buy one and you can hand over the task.,After completion, there will be an egg on the ground.,Click on it to open it and it's a chicken.。 Now BL can do this quest as well, in the Newbie Village outside the darkness.

6 answers2024-04-01

You can write numbers and Chinese characters on white paper as a literacy tutorial, and you can also use discarded items such as cans to teach children to roll them into the shape of candy with newspaper or white paper, and then draw their favorite patterns on them. You can also use a mineral water bottle to cut a sunburst pattern with scissors and paint it with a watercolor pen. You can also use yogurt boxes to make bucket trucks and other shapes. >>>More