moving a proc
Author |
Message |
msimard8
|
Posted: Mon Nov 29, 2004 5:56 pm Post subject: moving a proc |
|
|
Is there a way to move a proc to a seperate location without changing the codes in the proc. This is a small (non artistic) version of a man i am making for a game.
I want him to move to the center screen without changing any coordinates.
Also is there away to make him almost walk to the center screen without putting a counting loop INSIDE the procedure?
thanks
code: |
proc man
drawfillbox (30, 30, 40, 80, red)
drawfilloval (35, 85, 10, 10, 37)
drawline (30, 65, 1, 100, black)
drawline (40, 65, 60, 100, black)
end man
man
|
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Neo
![](http://compsci.ca/v3/uploads/user_avatars/441131374462fea7633fd3.gif)
|
Posted: Mon Nov 29, 2004 6:02 pm Post subject: (No subject) |
|
|
You would have to change the coordinates, otherwise how would the computer know where to draw the circles or lines or boxes? |
|
|
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Mon Nov 29, 2004 6:24 pm Post subject: (No subject) |
|
|
msimard8 wrote: Is there a way to move a proc to a seperate location without changing the codes in the proc. This is a small (non artistic) version of a man i am making for a game.
Yes. Use parameters for your procedure.
code: |
proc man (x, y : int)
drawfillbox (30 + x, 30 + y, 40 + x, 80 + y, red)
drawfilloval (35 + x, 85 + y, 10, 10, 37)
drawline (30 + x, 65 + y, 1 + x, 100 + y, black)
drawline (40 + x, 65 + y, 60 + x, 100 + y, black)
end man
man (50, 50)
man (300, 100)
|
Noticce that you don't want to add x and y to the 3rd and 4th parameter of drawfilloval, because those parameters are for radius. Adding to radius is not what you want
msimard8 wrote: Also is there away to make him almost walk to the center screen without putting a counting loop INSIDE the procedure?
What do you mean, "a countring loop"? a for loop? Or a loop that has a counter variable that changes each time through the loop?
And what do you mean walk? Are you talking about animation? or just simply moving his picture. If your talking about the second one, try doing things like this:
code: |
setscreen ("offscreenonly")
proc man (x, y : int)
drawfillbox (30 + x, 30 + y, 40 + x, 80 + y, red)
drawfilloval (35 + x, 85 + y, 10, 10, 37)
drawline (30 + x, 65 + y, 1 + x, 100 + y, black)
drawline (40 + x, 65 + y, 60 + x, 100 + y, black)
end man
man (50, 50)
for i : 50 .. 200
cls
man (i, i)
View.Update
delay (10)
end for
|
Of course, that won't get him directly to the centre of the screen. Play around with the idea a bit. |
|
|
|
|
![](images/spacer.gif) |
msimard8
|
Posted: Mon Nov 29, 2004 6:30 pm Post subject: thanks |
|
|
Thanks so much
You answered both of my questions...i just wanted to move the object and I meant for loop. my teacher just calls them counting loops.
sry
thanks |
|
|
|
|
![](images/spacer.gif) |
|
|