Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DRAW sequence m option
#11
(11-14-2022, 08:47 AM)PhilOfPerth Wrote: Can someone please elaborate a bit on the m x,y (and its related +/- options)  in the draw command? It doesn't get a mention (that I can find) in the Help file, and the Wiki one is pretty unclear. How is it fitted into a draw string, and does it need parentheses, or commas etc?  Confused

Sample code if you want to play around:

Code: (Select All)
screen _newimage(200, 200, 12)

xf = 150
yf = 150

do
x = int(rnd*200)
y = int(rnd*200)
draw "B M" + str$(x) + "," + str$(y)
draw "d15 r15 u15 l15 m " + str$(xf) + "," + str$(yf)
_display
_delay 1.25
loop
Reply
#12
Ok, one more shot at this 

This seems to work

Screen 9
PSet (10, 10), 2

Draw "D50"
Draw "r100"
Draw "u50"
Draw "l100"
Draw "M25,50"
Draw "M" + "25,-10"

At least it doesn't error out
Reply
#13
(11-14-2022, 06:49 PM)CharlieJV Wrote:
(11-14-2022, 08:47 AM)PhilOfPerth Wrote: Can someone please elaborate a bit on the m x,y (and its related +/- options)  in the draw command? It doesn't get a mention (that I can find) in the Help file, and the Wiki one is pretty unclear. How is it fitted into a draw string, and does it need parentheses, or commas etc?  Confused

Sample code if you want to play around:

Code: (Select All)
screen _newimage(200, 200, 12)

xf = 150
yf = 150

do
x = int(rnd*200)
y = int(rnd*200)
draw "B M" + str$(x) + "," + str$(y)
draw "d15 r15 u15 l15 m " + str$(xf) + "," + str$(yf)
_display
_delay 1.25
loop

And now, for the giggles, try the same program with a little tweak so that the second M command is a relative coordinate instead of a fixed coordinate:

Code: (Select All)
screen _newimage(200, 200, 12)

xf = 150
yf = 150

do
x = int(rnd*200)
y = int(rnd*200)
draw "B M" + str$(x) + "," + str$(y)
draw "d15 r15 u15 l15 m -" + str$(xf) + ",-" + str$(yf)
_display
_delay 1.25
loop
Reply
#14
Thanks Charlie and Dimster. It's much clearer now. Time to go play!
The question was related to a little exercise I'm doing at the moment, involving pi.
(no, Bplus, not that pie)!
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#15
I hope it's apple! :-))
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply
#16
Does Apple Pi run on Windows?

Pete
Shoot first and shoot people who ask questions, later.
Reply
#17
(11-14-2022, 10:54 PM)Pete Wrote: Does Apple Pi run on Windows?

Pete
Apple pi doesn't run!  Lemonade runs!
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#18
(11-14-2022, 08:16 PM)Dimster Wrote: :
Draw "M" + "25,-10"

At least it doesn't error out

The plus sign needs to be inside the quoted string like:
Code: (Select All)
Draw "M+25,-10"

so the processor knows it's a relative draw. You wouldn't be able to change the plus to minus in that line of code of yours because it would give out a syntax error.
Reply
#19
(11-14-2022, 10:59 PM)PhilOfPerth Wrote:
(11-14-2022, 10:54 PM)Pete Wrote: Does Apple Pi run on Windows?

Pete
Apple pi doesn't run!  Lemonade runs!

I tried putting Lemonade on my Windows, once, but my keyboard shorted out. I guess I made a pour choice.

Pete
Reply
#20
(11-14-2022, 11:08 PM)Pete Wrote:
(11-14-2022, 10:59 PM)PhilOfPerth Wrote:
(11-14-2022, 10:54 PM)Pete Wrote: Does Apple Pi run on Windows?

Pete
Apple pi doesn't run!  Lemonade runs!

I tried putting Lemonade on my Windows, once, but my keyboard shorted out. I guess I made a pour choice.

Pete
Sounds like you'll need a new keyboard, if your liquid assets allow it!
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why is 'option' treated like a reserved word in the IDE? Pete 2 568 04-11-2025, 10:03 PM
Last Post: Pete
  IDE search option eoredson 1 535 05-29-2024, 10:15 AM
Last Post: hsiangch_ong
  Using color in Draw string PhilOfPerth 30 4,992 04-09-2024, 09:52 PM
Last Post: TerryRitchie
  Problem with DRAW or my "scanning" routine? James D Jarvis 9 1,924 06-29-2023, 05:39 PM
Last Post: James D Jarvis
  how do you stop a sequence of sounds created with the Sound command? madscijr 21 5,508 08-06-2022, 02:49 AM
Last Post: Pete

Forum Jump:


Users browsing this thread: 2 Guest(s)