This site requires JavaScript, please enable it in your browser!
Greenfoot back
ronald
ronald wrote ...

2019/6/30

drawline

1
2
ronald ronald

2019/7/4

#
i'm trying to move a vertical line drawLine (100,20,100,200), can you give me ideas, a way to do without giving me the code, i try to fool myself. thank you
Super_Hippo Super_Hippo

2019/7/4

#
What exactly do you mean with "move"? If you want to change position in runtime, then it might be useful to make an actor with the image and move the actor around. Otherwise: The parameters of the method are X1, Y1, X2, Y2, so it connects the points (X1|Y1) and (X2|Y2). X is the horizontal axis and Y the vertical.
ronald ronald

2019/7/4

#
move the vertical line to the right as with the images but I can not do it
danpost danpost

2019/7/5

#
ronald wrote...
move the vertical line to the right as with the images but I can not do it
You need to find a way to return the current line's pixels back to their original color and then draw the new line. The operation would require two drawLine commands (along with two setColor commands) OR one drawImage command (using an image that will cover both lines and adjust those pixels accordingly).
ronald ronald

2019/7/10

#
I do not know how to do it, can you give me an overview or give me the code thank you
danpost danpost

2019/7/10

#
ronald wrote...
I do not know how to do it, can you give me an overview or give me the code thank you
(1) set color white; (2) draw line; (removes old line) (3) adjust coordinates of line; (4) set color black; (5) draw line; (draws new line)
You need to login to post a reply.
1
2