i am a beginer . i want a very very simple program to shoot an object(shape) for me on the form with a certain angle .
Printable View
i am a beginer . i want a very very simple program to shoot an object(shape) for me on the form with a certain angle .
you mean move and object?
you know what i mean . like the old gorilla game . but not that complicated!!!!!!!!!!!
i want a very very simple one.
i want to give an angle (and maybe a velocity) and after pressing a button the object (shape) will move across the form according to the calculations . and don't worry , i am good in physics.
please , give me the simplest way.
thankyou
to move the object from one point to another
VB Code:
Slope = (EndY - StartY) / (EndX - StartX) For X = StartX To EndX Object.Left = X Object.Top = X * Slope Next X
im not so good in working with angles, but i think i can show you later....eating right now :)
please help we with angle shooting (moving an object ).
well,is there anyone else to help. does anyone know how to code such a program. in the simplest way for a beginer!
thank you
Use a picture box and a timer. Put a picture of the thing you want to move in the picture box. Then set the interval of the timer to 50 or something and enabled to true.
In the timer event write something like
VB Code:
Picture1.left = picture1.left + 1
thanks, but i know about moving an object . i want to learn about moving an object with an angle .
here's the program :
i have a command button and a shape in my form along with a text box .after adding an amount in the textbox and clicking the button, the shape is shot and flies through the form. actually the amount that goes in the textbox is the angle that the shape should be shot at. something like the old gorilla game but not that complicated!!!!!very very simple.
thankx again.
VB is using Rad and not degrees. So first you have to calculate the angle in PI. Then you will have to calculate the X and Y vectors. I suppose you have to enter the velocity somewhere in you app too. So then you can calculate the X and Y speed.
In the timer event add the X speed to the left property and the Y component in the top property...
...If you didn't get that, look here for a start...
thank you so much. it really worked in the simplest way.!!!!
thankx again.
uhhhhhhhhhhhh.
is there anyway to tell the shape to come down after it travels a certain distance.(like a parabola path) . can you help me again in the simplest way.:)
OK, this is pure physics. I hope you get this....
I hope Newton is a great friend of yours ;)Quote:
and don't worry , i am good in physics.
At first we want talk about wind and air. Only pure physics. The formulas for "diagonally throws" is:
V0x = V0 *cosA I used this formula in my app.
V0y = V0 *sinA I used this formula in my app.
Vx = V0x The Speed in the X way, wont change with no air...
Vy = V0y - g*t The speed in the Y way, will change with t and g.
X = V0x*t
Y = V0y*t - 0,5*g*t^2
g = 9.81m/s^2
So you have to calculate a new X and Y every time the ball is moving. (that would be in the timer event) and then move the ball.
If you have problems understanding this, post again. And I will see what I can do...but try for your selves first...
OK, I admit that I'm bored....so here you have an example...
thankyou so much , i was looking for such a great help in a very simple way for months! the code was excellent !;)
Quote:
Originally posted by mnbvcxz
thankyou so much , i was looking for such a great help in a very simple way for months! the code was excellent !;)
The code isn't that great...it's just a little physics. But I'm glad someone found it usefull. So just post again if you or anyone else have more questions to ask...:)