|
-
May 7th, 2000, 02:11 AM
#1
hi,
im making a paratrooper type game and i was wondering how
you get the bullet (an image) to shoot in accordance with the angle of the gun (a line). help woul be apreciated.
-thanks
-t_dawolf
-
May 7th, 2000, 02:18 AM
#2
transcendental analytic
Make two variables for two dimensions, use cos(angle) for x and sin(angle) for y, angle should be in radians
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 7th, 2000, 02:34 AM
#3
ok,
what do i do once thats done?
-thanks
-t_dawolf
-
May 7th, 2000, 04:28 AM
#4
transcendental analytic
Have a mainloop or timer to move the bullet(s) according to the speed(s)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 7th, 2000, 06:07 AM
#5
ok,
i got the timer thing but they still go straight up.
im still a little confsed on how to get the angle.
is their a property that would show me the angle?
-thanks
-t_dawolf
-
May 7th, 2000, 03:53 PM
#6
transcendental analytic
Just use the angle when you initialize your bullet, and its direction, after that use the speedx and speedy, to move the bullet. you set the angle by your ow
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 8th, 2000, 03:40 AM
#7
transcendental analytic
Angle is not what you findout, or calculate, you set it, it depends on which direction you want to fire.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 8th, 2000, 07:00 AM
#8
im sorry
you msut think im the biggest idiot in the world,
but i don't get it. how do i set it to go to a different
place with every possible angle? do i have to do it manually?
their must be an easier way. even if you don't respond,
thanks for your help.
-thanks
-t_dawolf
-
May 8th, 2000, 07:29 AM
#9
Hyperactive Member
It depends on your type of game. Is the player going to click on a certain point and the bullet has to fly through that or will they rotate a "turret" left and right and enter a power level?
"People who think they know everything are a great annoyance to those of us who do."
-
May 8th, 2000, 07:50 AM
#10
well,
you move the turret with the arrows, and you press the space
bar to shoot, it goes off the screen no matter what unless
it hits a plane or paratrooper.
-thanks
-t_dawolf
-
May 8th, 2000, 04:53 PM
#11
transcendental analytic
Here's how you can set the angle by pressing keys
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
angle = angle + 0.1
Case vbKeyRight
angle = angle - 0.1
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 8th, 2000, 04:55 PM
#12
transcendental analytic
Sorry, forgot.
Put a End select before End sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 8th, 2000, 10:45 PM
#13
thanks
ill try that once i get home and then get back to you.
-thanks
-t_dawolf
-
May 9th, 2000, 06:31 PM
#14
ok,
im at my wits end trying to get this. there has got to be
a way! so if anyone out there knows how, please, please tell me.
-thanks
-t_dawolf
p.s.
the code didn't work
-
May 9th, 2000, 06:32 PM
#15
p.s.
thanks for all your help anyways
-t_dawolf
-
May 10th, 2000, 12:29 AM
#16
New Member
Anyone have a good algorithm on moving the bullet if
you know x1,y1, x2 and y2?
Well, it's a pentium parrot, besides, it's only a decimal.
-
May 10th, 2000, 03:59 AM
#17
transcendental analytic
That depends on what does x1,x2 y1,y2 are.
Basically you need to know a set of speed in x and y vectors, an angle and general velocity, or the startcord and endcord+velocity. if i think right, what you're missing is the velocity and you can have a method that does it
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 10th, 2000, 07:40 PM
#18
New Member
x1 and y1 is the starting point, x2 ans y2 is the ending point, the velocity is of no importance..
Well, it's a pentium parrot, besides, it's only a decimal.
-
May 10th, 2000, 08:00 PM
#19
so how would i get the angle from x1 and y1 to x2 and y2?'
i can't think of anything offhand.
-thanks
-t_dawolf
-
May 11th, 2000, 03:26 AM
#20
transcendental analytic
Why do you want to know the angle anyway? That's if you have a specified direction to shoot your bullet from and you will calculate the coordinates based on that angle.
Anyway i'm going to explain how to get that damn angle:
Code:
angle=atn((y1-y2)/(x1-x2))
atn stands for arcus tangens, if you want to know
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|