ArcBasicDocs

tutorials/beginner

07_mouse.abs

34 lines of ArcBasic. Words in colour that are commands link to their help page. To run it, download ArcBasic, open the file and press F5.

Download 07_mouse.absAll files in this folder

07_mouse.abs
; A pet that follows the mouseGraphics 640, 480SetBuffer BackBuffer()x# = 320 : y# = 240size = 40While Not KeyHit(1)	; move a tenth of the way to the mouse each frame: quick when far, gentle when close	x = x + (MouseX() - x) * 0.1	y = y + (MouseY() - y) * 0.1	; left click makes it bigger, right click smaller	If MouseHit(1) And size < 120 Then size = size + 10	If MouseHit(2) And size > 20 Then size = size - 10	Cls	Color 120, 230, 120	Oval x - size / 2, y - size / 2, size, size	; eyes that look at the mouse	Color 255, 255, 255	Oval x - size / 4 - 6, y - size / 4, 12, 12	Oval x + size / 4 - 6, y - size / 4, 12, 12	Color 0, 0, 0	Oval x - size / 4 - 3 + (MouseX() - x) * 0.02, y - size / 4 + 3, 6, 6	Oval x + size / 4 - 3 + (MouseX() - x) * 0.02, y - size / 4 + 3, 6, 6	Color 255, 255, 255	Text 10, 10, "Move the mouse. Left click: grow. Right click: shrink."	FlipWendEnd