BBS: Inland Empire Archive Date: 07-23-92 (04:03) Number: 86 From: MING ONG Refer#: NONE To: CRAIG RANDLE Recvd: NO Subj: Re: Animation Conf: (2) Quik_Bas
-=> Quoting Craig Randle to All <=- CR> Does anyone have any idea on how to animate (or move) and CR> object without drawing it, dawing over it in bkgrnd color, and then CR> drawing it in the next position? This is very time consuming, and CR> difficult.. When you have large pictures and complicated backgrounds, CR> this is impossible... Any help is appreciated. CR> Craig Mr. Henshaw's message here may help you get started. This code will work. From: Coridon Henshaw Read: Yes Replied: No To: Giovanni Palmiotto Mark: Subj: Virtual Reality Quick Basic Help ****************************************************************************** After awaking from a long sleep, Giovanni Palmiotto, when seeing the ugly form of Coridon Henshaw, rose and stated: GP> Hi there Coridon, thank you for helping me. About the smooth GP> scrolling, can you please, write me a small source code, just so that GP> I get an idea of how it works. Thank You, other sources are Ok, here: -===- Cut Here -===- 'This example uses the PUT statement to create a moving white ball that 'ricochets off the sides of the screen until you press a key. DEFINT A-Z DIM Ball(804) 'Dimension integer array large enough 'to hold ball. SCREEN 12 CLS CIRCLE (16, 16), 14, 14 'Draw and paint ball. PAINT (17, 17), 14 GET (0, 0)-(32, 32), Ball X = 0: Y = 0 Xdelta = 2: Ydelta = 1 DO 'Continue moving in same direction as long as ball is within 'the boundaries of the screen - (0,0) to (640,200). X = X + Xdelta: Y = Y + Ydelta IF INKEY$ <> "" THEN END ' Test for key press. 'Change X direction if ball hits left or right edge. IF (X < 1 OR X > 600) THEN Xdelta = -Xdelta END IF 'Change Y direction if ball hits top or bottom edge. IF (Y < 1 OR Y > 400) THEN Ydelta = -Ydelta END IF 'Put new image on screen, simultaneously erasing old image. PUT (X, Y), Ball, PSET WAIT &H3DA, 0 'Kill this line if this program hangs on you. WAIT &H3DA, 8 '<<<<<<<<<< This makes it smooth LOOP -===- Cut Here -===- Code credits belong to Corridon Henshaw. ... Programmers get overlaid! --- Blue Wave/TG v2.10 [NR] * Origin: The Cactus Connection - 602-998-0731 (1:114/169.0)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET