Computer Science Canada Lines, and time. |
Author: | Prognosis [ Sat Jan 21, 2006 11:10 pm ] | ||
Post subject: | Lines, and time. | ||
Well, im new to these forums, but i consider myself a fast learner, and am using turing for my first few months. Ive already made my program so it makes a line from the center of the screen to where you click, and it keeps going. I did this by finding out the equation of the line (using the center point, and where you clicked), and drew the line pixel by pixel. BUT.. There are many bugs, such as: 1. the speed of the line getting drawn changes in comparison to where you click. 2: in some places (when xclick and centerx are closer together), it isnt a line, but a series of dots. Those 2 errors sound weird now, but they will become more clear when the program is run. Please help me to fix these bugs. Also, help me to enable you to shoot more than one line out at once (this is because these lines are accually lazers for my new game)
|
Author: | Delos [ Sun Jan 22, 2006 9:23 am ] |
Post subject: | |
Hmm...interesting. Ever noticed that the changing speeds for some sort of pattern? Well, they do. Those closer to the vertical are drawn faster, simply because they have a larger slope (m). Work around that. You get a series of dots, partly for the above state reason, and partly because you are using drawdot() ![]() Also, you've error proofed against drawing a vertical line (infinite slope, non-diff'able) but you haven't included a clause to draw such a line should it be clicked. That needs fixing! As for multiple lines - it's possible, but a little more complicated. You'll have to move on to some simple Object Oriented programming first (read the [Tuts] on records, procedures, for a start). BTW: Thank you for the excellent problem description. And laser has an 's' in it. |
Author: | Prognosis [ Sun Jan 22, 2006 10:19 am ] |
Post subject: | |
Hmm, im really glad that someone understands what im trying to do here... but that didnt quite give me everything i wanted to know. Of course i knew that the bigger the slope, the faster the line grows. This is simply because... say the slope 10.. then it would go 10 up every time it went through the loop, rather than 1 or less up. But you didnt give me what I needed to do. Can someone give me an idea on how to even out the slope and the delay... thats the only way i can see it being done. And dude, you said use a drawline instead,,, the whole point of this is so it goes Slowly, not in one motion. I want this because you will be a ship in the middle of the screen, and you need to shoot other ships, using lasers!!!!!!!! ![]() So does anyone know how to accually fix this? |
Author: | Rasta Fella [ Sun Jan 22, 2006 12:25 pm ] | ||
Post subject: | |||
Do you mean you want to make the delay slower for the lasers? Or do you want like you shoot one laser and then want it to dissapear after? |
Author: | Delos [ Sun Jan 22, 2006 5:20 pm ] |
Post subject: | |
He means that the User should have the ability to create several instances of the laser, each of which would travel in the specified direction, but all at the same speed. While one is still travelling, the other should be able to move as well. |
Author: | Cervantes [ Sun Jan 22, 2006 5:36 pm ] |
Post subject: | Re: Lines, and time. |
Prognosis wrote: Also, help me to enable you to shoot more than one line out at once (this is because these lines are accually lazers for my new game)
Check the Flexible Array Tutorial. It's got an example of this. |