How to move things I draw in Turing?
Author |
Message |
jzc1995
|
Posted: Wed Sep 15, 2010 7:07 pm Post subject: How to move things I draw in Turing? |
|
|
What is it you are trying to achieve?
I'm new to here and I'm new to Turing. And I am not very good at English.
I want to move a star form where it is to another place that I want.
What is the problem you are having?
For example, I have a star at (50,50,100,100), and I want to move it to (100,100,150,150), what can I do?
And can I control the its moving speed?
Thanks for help me!
Describe what you have tried to solve this problem
I try to find the language I need in the Turing Reference, but I can't understand it.
I also try to draw star, remove star, draw star, remove star..... but that is to complex, and I post what I try below.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
setscreen("graphics:800;600")
drawfillstar(50,50,100,100,yellow)
delay (100)
drawfillstar(50,50,100,100,0)
drawfillstar(55,55,105,105,yellow)
delay(100)
drawfillstar(55,55,105,105,0)
drawfillstar(60,60,110,110,yellow)
delay(100)
drawfillstar(60,60,110,110,0)
drawfillstar(65,65,115,115,yellow)
delay(100)
drawfillstar(65,65,115,115,0)
drawfillstar(70,70,120,120,yellow)
delay(100)
drawfillstar(70,70,120,120,0)
drawfillstar(75,75,125,125,yellow)
delay(100)
drawfillstar(75,75,125,125,0)
drawfillstar(80,80,130,130,yellow)
delay(100)
drawfillstar(80,80,130,130,0)
drawfillstar(85,85,135,135,yellow)
delay(100)
drawfillstar(85,85,135,135,0)
drawfillstar(90,90,140,140,yellow)
Please specify what version of Turing you are using
The version of Turing that I am using is 4.1.1. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
mirhagk
|
Posted: Wed Sep 15, 2010 8:18 pm Post subject: RE:How to move things I draw in Turing? |
|
|
i'd suggest storing the position of the star in variables, and then changing those. What you have of colouring white over the old star, and drawing a new one after you change the position.
You should use a loop for this so that you only need about 5 lines of code. (a for loop would be best I think)
If you do not know anything about loops, I'd suggest reading the Turing Walkthrough tutorial (I believe it's a sticky on here) |
|
|
|
|
 |
jzc1995
|
Posted: Wed Sep 15, 2010 9:21 pm Post subject: RE:How to move things I draw in Turing? |
|
|
Thanks, I should think of that, I know loop and variables,Thank you for your help! |
|
|
|
|
 |
TWizard

|
Posted: Tue Sep 21, 2010 2:39 pm Post subject: RE:How to move things I draw in Turing? |
|
|
Eh well this will shorten what you wanted to do a lot.
var pos_x1, pos_x2 : int
var pos_y1, pos_y2 : int
pos_x1 := 50
pos_x2 := 100
pos_y1 := 50
pos_y2 := 100
for i : 1 .. 10
cls
drawfillstar(pos_x1,pos_y1,pos_x2,pos_y2,red)
pos_x1 := pos_x1 + 10
pos_x2 := pos_x2 + 10
pos_y1 := pos_y1 + 10
pos_y2 := pos_y2 + 10
delay (25)
end for
You can use a for statement with what your trying to do.
It will run though the for statement 10 times before stopping.
Theres a lot of other ways to do this but i find this is the more effective.
So I hope this will help you. |
|
|
|
|
 |
|
|