Printxy is like a combination of the Point function and the Print function. Printxy allows you to position text anywhere on the Cybiko screen. The format of the Printxy command is:
printxy x,y, value [, value ]
The text string is composed of the values of the variables after the Y coordinate. The text string is printed at the coordinates X, Y. The values will be painted with the X/Y coordinate in the upper left corner of the text. The values can be any collection of comma-separated variables or literals just as in Print.
Our Example Program will print your name on the display and bounce it off the edges of the screen. Try using shorter names to see how the performance improves.
DO THIS |
Copy the
file "c:\
\B2Cv5\tutorial\ch14.b2c" to "C:\
\B2Cv5\ch14.b2c".
Then execute the command "build ch14.b2c". Download the ch14.app file
to the cybiko.
dim name[32] as char'your name dim x as int 'x coordinate of your name dim y as int 'y coordinate of your name dim dx as int 'direction the name moves in x coord dim dy as int 'direction the name moves in y coord input "Enter your name ", name x = 80-rnd(160) 'random x starting point y = 43-rnd(86) 'random y starting point dx = -1 ' moving to the left dy = -1 'moving up while 1 'do forever or until ESC is pressed cls 'clear the screen printxy x,y, name 'print the name onscreen x=x+dx 'move x dir y=y+dy 'move y dir if x>80 then dx=-dx ' bounce off right side end if if x<-80 then dx=-dx ' bounce off left side end if if y>30 then dy=-dy 'bounce off bottom end if if y<-43 then dy=-dy 'bounce off top end if wend
|
file: /Techref/cybiko/b2c/ch15.htm, 3KB, , updated: 2008/6/13 15:59, local time: 2024/11/26 17:43,
18.116.14.48:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/cybiko/b2c/ch15.htm"> cybiko b2c ch15</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.