|
-
Jan 18th, 2001, 05:16 AM
#1
Thread Starter
Frenzied Member
Hi guys! 
I'm programming a "Space-Shoot-Em-Up" game!
In the bottom of the screen I have the "Shooter" , which is 5 lines. I need to find the middle of the bottom line Shooter(0), and then "fire" another line, "Fire", up in the "sky"....How is this possible....??
-
Jan 18th, 2001, 09:39 AM
#2
transcendental analytic
middle point of a line is the average of the endpoints of the line, calculate for each dimension component. I don't know how you want it to fire it up in the "sky"
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.
-
Jan 18th, 2001, 12:53 PM
#3
Thread Starter
Frenzied Member
What you say is, X2 / 2......or am I wrong....????
I want the Fire line to go upwards on the screen(fly up the screen) I know i can do that by altering the Y2, but it has to start from the middle of the bottom line, Shooter.
-
Jan 18th, 2001, 12:57 PM
#4
transcendental analytic
The average of a say 2 2d points is (point1.x+point2.x)\2,(point1.y+point2.y)\2 you start the fire line from this point and decreament Y of both points in the line that represent the fire i guess..
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.
-
Jan 18th, 2001, 01:02 PM
#5
Thread Starter
Frenzied Member
I don't quite understand that....
Let's say the that I want to find the middle of Line1, which vb code do I use....And how do I make the other line start from there...
-
Jan 18th, 2001, 01:52 PM
#6
transcendental analytic
What kind of line are you using, the line control?
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.
-
Jan 18th, 2001, 01:53 PM
#7
Frenzied Member
Code:
MidLineX = (Line.X1 + Line.X2) / 2
MidLineY = (Line.Y1 + Line.Y2) / 2
' Midpoint is (MidLineX, MidlineY)
Harry.
"From one thing, know ten thousand things."
-
Jan 18th, 2001, 03:08 PM
#8
Thread Starter
Frenzied Member
Thanks harryw....but.....(to kedaman) I am using the line control, but I want to fire more than one line at a time, so I think I'm going to use the Line function.....Is this the best way....???
-
Jan 18th, 2001, 04:08 PM
#9
transcendental analytic
There are better ways, but i guess you could use line control for a lightweight game, Harry just showed you the point where your line should be fired from. Yes it's possible (everything is) to fire several lines, you would have to either create a control array of them or add them into a collection object.
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.
-
Jan 20th, 2001, 06:26 PM
#10
Frenzied Member
if it was diagonal you would do something like this:
(not using control names, just an equation)
sqrt((x2-x1)+(y2-y1))
-
Jan 23rd, 2001, 03:04 PM
#11
Steve:
thats the formula for the length of a line, not the midpoint =)
-
Jan 23rd, 2001, 03:26 PM
#12
Frenzied Member
Well it's nearly the formula for the length of a line... that would be sqrt((x2-x1)²+(y2-y1)²)
Harry.
"From one thing, know ten thousand things."
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
|