#### Archived

This topic is now archived and is closed to further replies.

# Question

This topic is 5529 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was wondering how to (im a newbie) with Visual Basic make a picture or image follow a Curve... If you have ever seen thoose tank games were u have Angle of aimer and Power of Shot..I am wondering how to take thoose two values and create an equation that would both create the line (invisible) and make the picture/image follow this line. Im unsure of the exact equation or one that would work so that if u change angle..it would modify the line and if you change power it would make the line longer or shorter... Since im sort of new at VB an example of this or the actual code would be great.

##### Share on other sites
No offense, but you''ve got a long ways to go before you''ll be programming something like that. The first thing you should learn is physics and vector math. After that, you should learn a programming language that is better suited for graphics and games. When I first started programming, I didn''t want to learn C++, so I used QBasic until I was ready to learn C++. QBasic is a great language for experimenting and learning to program.

##### Share on other sites
So are Multimedia Fusion www.clickteam.com (no real programming required but you learn alot of algorithms and ways to things on, just easier) untill you feel ready for some C.
Visual Basic is quite good for that time of game you want to make i think...
It totally depends on you!

##### Share on other sites

What you want is the set of projectile euqtaions.
Try this:
Projectiles can be broken into 2 parts: horizontal and vertical
Okay, for s specific time u can use the following equations:

x = ut cos A
y = ut sin A + 0.5gt^2

Where:
u is your initial velocity (Power of shot)
t is your time (I''ll explain later)
A is your angle (Angle of aimer)
g is acceleration due to gravity (usualy about 9.81 or aprox to 10)

So the code will look something like:

Object.x = InitialVelocity * TimeValue * cos(Angle)
Object.y = InitialVelocity * TimeValue * sin(Angle) + 5*(t^2)

Basicly (its easy with VB) you move your object around using the equations. Choose a value for InitialVelocity and Angle and then basicaly assign the x and y co-cords of your object using teh equations. If you keep on incementing the size of time, (i.e. by using a timer control) then your object will fly in a nice curved (parabolic) path accross your form!

If you need more info, post back and I''ll try and knock up an example (using LINUX at the mo so a bit difficult to use VB!)

---------------

Does it matter? Even if it does matter, does it matter that it matters?

##### Share on other sites
lol..basic question..i put in the equations and set the values..yet how do u use x, y coordinates... get an error with Object.x and Object.y ...An example would be great if possible^

Question:

No it was wrong

##### Share on other sites
Think of it as a path for a shot,arrow, cannon , or something along that nature..I need that to follow the path

##### Share on other sites
Look, no offense, but there''s a beginner''s forum for a reason. You''re asking simple, basic questions about how to use a language. On top of that, even if you did know how to use the language, you don''t know how to do what you''re trying to do at all. If you learn a little more about your language, say, figure out how to display images at arbitrary points, and if you read a few basic math and physics tutorials, I''d be glad to help you. The questions you''re asking now, though, are not appropriate at all.

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631424
• Total Posts
3000008
×