how do i make the arrow move?
Author |
Message |
DBZ
|
Posted: Wed Nov 19, 2003 3:22 pm Post subject: how do i make the arrow move? |
|
|
i am having difficulty making an arrow move which i will describe at the bottom. everytime i try to make the arrow move, a part of it disappears. If you have a program similar to this, please send it to me.
the arrow is suppose to move from left bottom to right bottom and the move from right bottom to top right corner. then it moves from top left corner to top right corner and then it moves from top right corner to bottom right corner diagonaly.
Thanx! i appreciate it!
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Blade
|
Posted: Wed Nov 19, 2003 3:29 pm Post subject: (No subject) |
|
|
why don't you attach your code and we can help you with the problem
|
|
|
|
|
![](images/spacer.gif) |
thoughtful
![](http://www.chiefdelphi.com/pics/myfiles/1069591541avatar1.jpg)
|
Posted: Wed Nov 19, 2003 7:12 pm Post subject: (No subject) |
|
|
basically u can either you sin an cos functions, that will make it easy to turn it on any angle. Or if u want a simple program u can jus draw 2 or 3 arrow positions and then move them according to their positions.
|
|
|
|
|
![](images/spacer.gif) |
DBZ
|
Posted: Wed Nov 19, 2003 8:13 pm Post subject: (No subject) |
|
|
There is a problem with attatching my code. A friend of mine accidently overwrote on my disc and saved his stuff on my disc so now everytime i open the disc, it opens my friend's files . i am trying to find a way to recover that but if u know how to fix it then please tell me.
thanx!
|
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Wed Nov 19, 2003 8:49 pm Post subject: (No subject) |
|
|
you should really specify your problems what do you mean a part of it disappears? If so, then you're drawing over it for w/e reason
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
thoughtful
![](http://www.chiefdelphi.com/pics/myfiles/1069591541avatar1.jpg)
|
Posted: Thu Nov 20, 2003 12:20 am Post subject: (No subject) |
|
|
Well i found something in my old programs and i modified it to make a procedure which will make the arrow move. I jus did this to show u how all this works don;t pass this on as your program, let your teacher know if u use this procedure to draw ur arrow, and put my name + www.compsci.ca in the credits.
code: |
View.Set ("offscreenonly")
View.Set ("Title:Thoughtful's arrow mover")
procedure drawmovearrow (x1_temp : int, y1_temp : int, x2_temp : int, y2_temp : int, lengthd : int, NumOfTimeForAnimation : int, colord : int)
var slope, ang, ang1 : real
var x1, x2, y1, y2, xspd, yspd : real
x1 := x1_temp
x2 := x2_temp
y1 := y1_temp
y2 := y2_temp
const arrowwide := 40
if (x2 = x1) then
x2 += 0.001
end if
if not (x2 = x1) then
slope := (y2 - y1) / (x2 - x1)
end if
if not (x2 = x1) then
if slope >= 0 then
ang := arctand (abs (slope))
end if
end if
if not (x2 = x1) then
if slope <= 0 then
ang := 90 - (arctand (abs (slope)))
end if
end if
if (x2 = x1) and y2 - y1 > 0 then
ang := 90
elsif (x2 = x1) and y2 - y1 < 0 then
ang := 270
end if
if y2 - y1 > 0 and x2 - x1 < 0 then
ang := ang + 90
end if
if y2 - y1 = 0 and x2 - x1 < 0 then
ang := ang + 180
end if
if y2 - y1 < 0 and x2 - x1 < 0 then
ang := ang + 180
end if
if y2 - y1 < 0 and x2 - x1 > 0 then
ang := ang + 270
end if
ang1 := 90 - ang
if slope = 0 and x2 - x1 < 0 then
ang1 := -90
end if
if slope = 0 and x2 - x1 > 0 then
ang1 := -270
end if
ang1 += 180
xspd := (x2 - x1) / NumOfTimeForAnimation
yspd := (y2 - y1) / NumOfTimeForAnimation
for i : 1 .. NumOfTimeForAnimation
drawline (round (x1), round (y1), round (x1 + lengthd * sind (ang1)), round (y1 + lengthd * cosd (ang1)), colord)
drawline (round (x1), round (y1), round (x1 + lengthd div 3 * sind (ang1 - arrowwide)), round (y1 + lengthd div 3 * cosd (ang1 - arrowwide)), colord)
drawline (round (x1), round (y1), round (x1 + lengthd div 3 * sind (ang1 + arrowwide)), round (y1 + lengthd div 3 * cosd (ang1 + arrowwide)), colord)
x1 += xspd
y1 += yspd
delay (50)
View.Update
cls
end for
end drawmovearrow
drawmovearrow (100, 100, 100, 350, 30, 50, red)
% syntax: drawmovearrow (arrow start x, arrow start y, arrow finish x, arrow finish y, arrow length, number of times the loop will execute in the procedure(greater=slow speed), red)
|
|
|
|
|
|
![](images/spacer.gif) |
Tendulkar
|
Posted: Tue Nov 25, 2003 11:07 pm Post subject: Re: how do i make the arrow move? |
|
|
% HERE IS YOUR CODE:
setscreen ("offscreenonly")
for i : 1 .. maxx
drawline (i, 20, i + 30, 20, brightgreen)
drawline (i + 30, 20, i + 25, 23, brightgreen)
drawline (i + 30, 20, i + 25, 17, brightgreen)
View.Update
drawfillbox (0, 0, maxx, maxy, black)
end for
|
|
|
|
|
![](images/spacer.gif) |
Tendulkar
|
Posted: Thu Dec 04, 2003 10:23 pm Post subject: Re: how do i make the arrow move? |
|
|
Here is what you need for your program!
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
Arrow.t |
Filesize: |
10.66 KB |
Downloaded: |
265 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tendulkar
|
Posted: Thu Dec 04, 2003 10:25 pm Post subject: Re: how do i make the arrow move? |
|
|
Here is what you need for your program!
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
Arrow.t |
Filesize: |
10.66 KB |
Downloaded: |
312 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
|
|