Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CLS
- SCREEN _NewImage(1920, 1080, 8)
- _FullScreen _SquarePixels
- DIM SHARED particlex
- DIM SHARED particley
- DIM SHARED particler
- DO
- PCOPY _Display, 1
- LINE (10, 10)-(130, 30), 11, B
- IF particles < 2 THEN
- LOCATE 3, 3
- PRINT "PLACE PLANET "
- ELSE
- LOCATE 3, 3
- PRINT "PLANET PLACED"
- END IF
- _Display
- PCOPY 1, _Display
- WHILE _MouseInput
- IF _MouseX >= 10 AND _MouseY >= 10 AND _MouseX <= 120 AND _MouseY <= 30 AND _MouseButton(1) = -1 THEN
- PCOPY _Display, 1
- IF particles < 2 THEN
- particles = particles + 1
- placeplanet 4, particles
- ELSE
- LOCATE 3, 3
- PRINT "MAX PLACED "
- SLEEP 2
- END IF
- _Display
- PCOPY 1, _Display
- END IF
- WEND
- LOOP UNTIL INKEY$ = CHR$(27)
- SYSTEM
- SUB placeplanet (radius, particles)
- drawn = 0
- DO
- PCOPY _Display, 1
- LINE (10, 10)-(130, 30), 11, B
- LOCATE 3, 3
- PRINT "PLACE PLANET"
- LOCATE 3, 20
- PRINT radius
- PRINT particlex
- PRINT particley
- PRINT particler
- PRINT distance
- PRINT xCenter
- PRINT yCenter
- DrawCircle xCenter, yCenter, radius
- _Display
- PCOPY 1, _Display
- WHILE _MouseInput
- xCenter = _MouseX
- yCenter = _MouseY
- IF particles >= 2 THEN
- distance = ((ABS(xCenter - particlex)) ^ 2 + (ABS(yCenter - particley)) ^ 2) ^ (1 / 2)
- IF distance >= particler + radius THEN
- prev_xCenter = xCenter
- prev_yCenter = yCenter
- prev_radius = radius
- END IF
- IF distance < particler + radius + 2 THEN
- xCenter = prev_xCenter
- yCenter = prev_yCenter
- radius = prev_radius
- END IF
- END IF
- IF particles = 1 THEN
- particlex = _MouseX
- particley = _MouseY
- particler = radius
- END IF
- IF radius < 1 THEN
- radius = 1
- ELSEIF radius > 450 THEN
- radius = 450
- ELSEIF _MouseWheel = -1 THEN
- radius = radius + 2
- ELSEIF _MouseWheel = 1 THEN
- radius = radius - 2
- ELSEIF _MouseButton(2) = -1 THEN
- DrawCircle xCenter, yCenter, radius
- drawn = 1
- END IF
- WEND
- LOOP UNTIL INKEY$ = CHR$(27) OR drawn = 1
- END SUB
- SUB DrawCircle (xCenter, yCenter, radius)
- FOR angle = 1 TO 720
- radians = angle * (_Pi / 360)
- x = xCenter + radius * COS(radians)
- y = yCenter + radius * SIN(radians)
- PSET (x, y), _RGB(255, 0, 0)
- NEXT angle
- END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement