Author Topic: MasterGy is looking for ideas to implement ("i suffer")  (Read 14596 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: i suffer
« Reply #45 on: March 13, 2021, 02:03:11 pm »
If the world weren't flat Flappy could fly around the pipes :-))

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: i suffer
« Reply #46 on: March 14, 2021, 12:22:51 am »
Put a moose in thar and sum cross hairs an ye got youself a real fun shootin game, varmint!

 - Sam
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: i suffer
« Reply #47 on: March 14, 2021, 02:54:49 pm »
Put a moose in thar and sum cross hairs an ye got youself a real fun shootin game, varmint!

 - Sam

Or maybe a horse that looks allot like somebodies else logo, and don't horse around by shooting at them, race them.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: i suffer
« Reply #48 on: March 14, 2021, 03:15:03 pm »
Hey, I could program that in SCREEN 0. Of course it would be a horse's ascii.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: i suffer
« Reply #49 on: March 15, 2021, 07:03:04 am »
infinite space illusion .control WASD and mouse

Code: QB64: [Select]
  1. DIM col(99) AS _INTEGER64, tris(19999, 10), points(19999, 10), cam(19), me(19)
  2. dim_s = 1000 'size of space
  3. max_vol = .4 'kocka darabszam a dim_s-hez kepest szazalekban
  4. d_min = 4 'csucs min
  5. d_max = 7 'csucs max
  6. r_min = 50 'legkisebb sugar
  7. r_max = 50 'legnagyobb_sugar
  8. rot_min = 1 / 100 'forgatas min sebesseg
  9. rot_max = 2 / 100 'forgatas max sebesseg
  10. sp_kalib = 3
  11. sp_min = .5 * sp_kalib
  12. sp_max = 2.5 * sp_kalib
  13.  
  14. crash = 1
  15. text_c = 50
  16. text_d = 150
  17. text_m = 7
  18. text_col = 70
  19.  
  20. msenx = .05 'mouse sensitive XY
  21. msenz = .08 'mouse sensitive Z
  22.  
  23. pre_calc = 2 'calculation for step multiplier impact test
  24. stepping = 10 'movement speed
  25. max_couch = 70 'correct angle of impact tolerance
  26. zoom_calib = .01
  27. zoom_xy = 20 * zoom_calib '_maptriangle multiplier XY
  28. zoom_distance = 60 * zoom_calib 'maptriangle multiplier Z (as large as fisheye optics)
  29.  
  30.  
  31.  
  32.  
  33. pip180 = _PI / 180
  34.  
  35. '-------------------------------------------------------------------------------------------------------------------------------------------------------
  36.  
  37. 'creating textures
  38. FOR t = 0 TO text_col - 1: col(t) = _RGB32(256 * RND(1), 256 * RND(1), 256 * RND(1)): NEXT t 'set object colors
  39. DIM text(text_c - 1)
  40. FOR t = 0 TO text_c - 1: temp = _NEWIMAGE(text_d, text_d, 32): _DEST temp: CLS
  41.     LINE (text_m, text_m)-(text_d - 1 - text_m, text_d - 1 - text_m), col(INT(text_col * RND(1))), BF
  42.     text(t) = _COPYIMAGE(temp, 33): _FREEIMAGE temp
  43.  
  44. 'creating 3d points
  45. DIM ob(9999, 19)
  46. DO WHILE volume_sum < dim_s ^ 3 / 100 * max_vol
  47.  
  48.     DO: re = 0: 'hova, es mekkora ?
  49.         ob(a_ob, 0) = INT(d_min + (d_max - d_min) * RND(1)) 'resolution 360/da degree horisontal DA
  50.         ob(a_ob, 1) = INT(d_min + (d_max - d_min) * RND(1)) 'resolution 360/db degree vertical     DB
  51.         ob(a_ob, 2) = points 'start ponits
  52.         ob(a_ob, 3) = r_min + (r_max - r_min) * RND(1) 'sugar
  53.         FOR t = 4 TO 6: ob(a_ob, t) = ob(a_ob, 3) + (dim_s - ob(a_ob, 3) * 2) * RND(1): NEXT t
  54.         IF a_ob THEN
  55.             FOR t = 0 TO a_ob - 1
  56.                 dis1 = ((ob(a_ob, 4) - ob(t, 4)) ^ 2 + (ob(a_ob, 5) - ob(t, 5)) ^ 2 + (ob(a_ob, 6) - ob(t, 6)) ^ 2)
  57.                 dis2 = (ob(a_ob, 3) + ob(t, 3)) ^ 2
  58.                 re = re OR (dis2 > dis1)
  59.             NEXT t
  60.         END IF
  61.     LOOP WHILE re
  62.     FOR t = 7 TO 9: ob(a_ob, t) = rot_min + (rot_max - rot_min) * RND(1): NEXT t 'random rotating arrow,speed
  63.     FOR t = 10 TO 12: ob(a_ob, t) = 360 * RND(1): NEXT t 'actual rotate
  64.     ob(a_ob, 14) = 360 * RND(1) 'radA arrow random
  65.     ob(a_ob, 15) = 360 * RND(1) 'radB arrow random
  66.     ob(a_ob, 16) = sp_min + (sp_max - sp_min) * RND(1) 'random speed
  67.  
  68.  
  69.     'creating squares
  70.     FOR da2 = 0 TO ob(a_ob, 0) - 2: FOR db2 = 0 TO ob(a_ob, 1) - 2
  71.             p0 = da2 * ob(a_ob, 1) + db2 + ob(a_ob, 2): p1 = p0 + 1: p2 = p0 + ob(a_ob, 1): p3 = p2 + 1: text_act = INT(text_c * RND(1))
  72.             tris(triangles, 0) = 1: tris(triangles, 1) = p0: tris(triangles, 2) = p1: tris(triangles, 3) = p2: tris(triangles, 4) = 0: tris(triangles, 5) = 0
  73.             tris(triangles, 6) = text_d - 1: tris(triangles, 7) = 0: tris(triangles, 8) = 0: tris(triangles, 9) = text_d - 1: tris(triangles, 10) = text_act
  74.             triangles = triangles + 1
  75.             tris(triangles, 0) = 1: tris(triangles, 1) = p3: tris(triangles, 2) = p1: tris(triangles, 3) = p2: tris(triangles, 4) = text_d - 1
  76.             tris(triangles, 5) = text_d - 1: tris(triangles, 6) = text_d - 1: tris(triangles, 7) = 0: tris(triangles, 8) = 0: tris(triangles, 9) = text_d - 1: tris(triangles, 10) = text_act
  77.             triangles = triangles + 1
  78.     NEXT db2, da2
  79.  
  80.     points = points + ob(a_ob, 0) * ob(a_ob, 1)
  81.     volume_sum = volume_sum + (4 * ob(a_ob, 3) ^ 3 * _PI / 3)
  82.     a_ob = a_ob + 1
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. DO: _LIMIT 100
  92.  
  93.     'control
  94.     kw = _KEYDOWN(119) OR _MOUSEBUTTON(1): ks = _KEYDOWN(115) OR _MOUSEBUTTON(2): ka = _KEYDOWN(97): kd = _KEYDOWN(100): et_ir = (ABS(ka OR kd OR kw) OR -ABS(ks))
  95.     ir = 0: IF inv_me10 = -1 THEN SWAP ka, kd
  96.     FOR elt1 = 0 TO max_couch STEP 2: FOR elt2 = 0 TO 360 STEP 12: IF ir = 0 THEN
  97.                 elt_xy = SIN(elt2 * pip180) * elt1: elt_z = COS(elt2 * pip180) * elt1
  98.                 szog_xy_elt = -90 * ABS(ka) + 90 * ABS(kd): szog_xy = me(10) + (szog_xy_elt + elt_xy) * pip180: szog_z = me(11) + pip180 * (90 + elt_z)
  99.                 irx = -SIN(szog_xy) * COS(szog_z): iry = -COS(szog_xy) * COS(szog_z): irz = SIN(szog_z): ir = et_ir: multi = stepping * ir * pre_calc * 2
  100.                 multi = stepping * ir / max_couch * (max_couch - elt1): me(0) = me(0) + irx * multi: me(1) = me(1) + iry * multi
  101.     me(2) = me(2) + irz * multi: END IF: NEXT elt2, elt1
  102.  
  103.     mousex = 0: mousey = 0: WHILE _MOUSEINPUT: mousex = mousex + _MOUSEMOVEMENTX: mousey = mousey + _MOUSEMOVEMENTY: WEND: me(11) = me(11) + mousey / 7 * msenz
  104.     me(11) = me(11) - 2 * _PI * ABS(me(11) > 2 * _PI): me(11) = me(11) + 2 * _PI * ABS(me(11) < 0): inv_me10 = 1: IF me(11) < _PI THEN inv_me10 = -1
  105.     me(10) = me(10) + mousex / 5 * msenx * inv_me10
  106.  
  107.  
  108.     FOR t = 0 TO 2
  109.         IF me(t) < 0 THEN me(t) = me(t) + dim_s
  110.         IF me(t) > dim_s - 1 THEN me(t) = me(t) - dim_s
  111.     NEXT t
  112.  
  113.  
  114.  
  115.  
  116.     'calculating objection points
  117.     FOR act_ob = 0 TO a_ob - 1
  118.         FOR da2 = 0 TO ob(act_ob, 0) - 1: dega = (360 / (ob(act_ob, 0) - 1) * da2) * pip180
  119.             FOR db2 = 0 TO ob(act_ob, 1) - 1: degb = (180 / (ob(act_ob, 1) - 1) * db2) * pip180
  120.                 ap = da2 * ob(act_ob, 1) + db2 + ob(act_ob, 2)
  121.                 x1 = SIN(degb) * COS(dega): y1 = SIN(degb) * SIN(dega): z1 = COS(degb)
  122.                 x2 = (x1 * COS(ob(act_ob, 12))) - (y1 * SIN(ob(act_ob, 12))): y2 = (x1 * SIN(ob(act_ob, 12))) + (y1 * COS(ob(act_ob, 12)))
  123.                 x3 = (x2 * COS(ob(act_ob, 11))) - (z1 * SIN(ob(act_ob, 11))): z2 = (x2 * SIN(ob(act_ob, 11))) + (z1 * COS(ob(act_ob, 11)))
  124.                 y3 = (y2 * COS(ob(act_ob, 10))) - (z2 * SIN(ob(act_ob, 10))): z3 = (y2 * SIN(ob(act_ob, 10))) + (z2 * COS(ob(act_ob, 10)))
  125.                 points(ap, 1) = x3 * ob(act_ob, 3) + ob(act_ob, 4)
  126.                 points(ap, 2) = y3 * ob(act_ob, 3) + ob(act_ob, 5)
  127.                 points(ap, 3) = z3 * ob(act_ob, 3) + ob(act_ob, 6)
  128.     NEXT db2, da2, act_ob
  129.  
  130.  
  131.  
  132.  
  133.  
  134.     'calculating view
  135.     me(5) = 0
  136.     cam(0) = me(0) - SIN(me(10) - 180 * pip180) * me(3) / 2
  137.     cam(1) = me(1) - COS(me(10) - 180 * pip180) * me(3) / 2
  138.     cam(2) = me(2) + me(5) / 4
  139.     cam(3) = me(10)
  140.     cam(4) = me(11)
  141.     cosrotz = COS(cam(3)): sinrotz = SIN(cam(3)): cosrotx = COS(cam(4)): sinrotx = SIN(cam(4))
  142.  
  143.     nei = 1
  144.     FOR cx = -nei TO nei: cx2 = cx * dim_s: FOR cy = -nei TO nei: cy2 = cy * dim_s: FOR cz = -nei TO nei: cz2 = cz * dim_s
  145.  
  146.                 FOR actual_point = 0 TO points - 1: IF points(actual_point, 1) THEN
  147.                         px = points(actual_point, 1) - cam(0) + cx2
  148.                         py = points(actual_point, 2) - cam(1) + cy2
  149.                         pz2 = points(actual_point, 3) - cam(2) + cz2
  150.                         px3 = px * cosrotz - py * sinrotz: py2 = px * sinrotz + py * cosrotz: py3 = py2 * cosrotx - pz2 * sinrotx: pz3 = py2 * sinrotx + pz2 * cosrotx
  151.                 points(actual_point, 4) = -px3 * zoom_xy: points(actual_point, 5) = -py3 * zoom_xy: points(actual_point, 6) = -pz3 * zoom_distance: END IF: NEXT actual_point
  152.  
  153.                 'drawing triangles
  154.                 FOR actual_triangle = 0 TO triangles - 1
  155.                     wx1 = points(tris(actual_triangle, 1), 4): wy1 = points(tris(actual_triangle, 1), 5): wz1 = points(tris(actual_triangle, 1), 6)
  156.                     wx2 = points(tris(actual_triangle, 2), 4): wy2 = points(tris(actual_triangle, 2), 5): wz2 = points(tris(actual_triangle, 2), 6)
  157.                     wx3 = points(tris(actual_triangle, 3), 4): wy3 = points(tris(actual_triangle, 3), 5): wz3 = points(tris(actual_triangle, 3), 6)
  158.                     sx1 = tris(actual_triangle, 4): sy1 = tris(actual_triangle, 5)
  159.                     sx2 = tris(actual_triangle, 6): sy2 = tris(actual_triangle, 7)
  160.                     sx3 = tris(actual_triangle, 8): sy3 = tris(actual_triangle, 9)
  161.  
  162.  
  163.                     _MAPTRIANGLE (sx1, sy1)-(sx2, sy2)-(sx3, sy3), text(tris(actual_triangle, 10)) TO(wx1, wy1, wz1)-(wx2, wy2, wz2)-(wx3, wy3, wz3), , _SMOOTH
  164.  
  165.                 NEXT actual_triangle
  166.     NEXT cz, cy, cx
  167.     _DISPLAY: CLS
  168.  
  169.     'moving/rotating objects
  170.     FOR act_ob = 0 TO a_ob - 1
  171.         FOR t = 0 TO 2: ob(act_ob, 10 + t) = ob(act_ob, 10 + t) + ob(act_ob, 7 + t): NEXT t 'rotating
  172.  
  173.         DO
  174.             ar(0) = SIN(ob(act_ob, 15)) * COS(ob(act_ob, 14)): ar(1) = SIN(ob(act_ob, 15)) * SIN(ob(act_ob, 14)): ar(2) = COS(ob(act_ob, 15))
  175.             FOR t = 0 TO 2
  176.                 poss(t) = ob(act_ob, 4 + t) + ar(t) * ob(act_ob, 16)
  177.                 IF poss(t) < 0 THEN poss(t) = poss(t) + dim_s
  178.                 IF poss(t) > dim_s THEN poss(t) = poss(t) - dim_s
  179.             NEXT t
  180.             re = 0
  181.             IF crash THEN
  182.  
  183.                 FOR an = 0 TO a_ob - 1: IF an = act_ob THEN _CONTINUE
  184.                     dis2 = (ob(an, 3) + ob(act_ob, 3))
  185.                     IF ABS(poss(0) - ob(an, 4)) > dis2 THEN _CONTINUE
  186.                     IF ABS(poss(1) - ob(an, 5)) > dis2 THEN _CONTINUE
  187.                     IF ABS(poss(2) - ob(an, 6)) > dis2 THEN _CONTINUE
  188.                     dis1 = SQR((poss(0) - ob(an, 4)) ^ 2 + (poss(1) - ob(an, 5)) ^ 2 + (poss(2) - ob(an, 6)) ^ 2)
  189.                     re = (dis2 > dis1): IF re THEN EXIT FOR
  190.                 NEXT an
  191.  
  192.                 IF re THEN
  193.                     ob(act_ob, 14) = 360 * RND(1) 'radA arrow random
  194.                     ob(act_ob, 15) = 360 * RND(1) 'radB arrow random
  195.                     ob(act_ob, 16) = sp_min + (sp_max - sp_min) * RND(1) 'random speed
  196.                     FOR t = 7 TO 9: ob(act_ob, t) = rot_min + (rot_max - rot_min) * RND(1): NEXT t 'random rotating arrow,speed
  197.                 END IF
  198.             END IF
  199.         LOOP WHILE re
  200.  
  201.         FOR t = 0 TO 2: ob(act_ob, 4 + t) = poss(t): NEXT t
  202.  
  203.     NEXT act_ob
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: i suffer
« Reply #50 on: March 15, 2021, 03:48:30 pm »
@MasterGy  That! is an interesting start to something but something is a bit off, not sure what, are you sensing it?

Plus I am giving giving you a ticket for all the double, triple, quadruple, quin... parking you are doing here:
Code: QB64: [Select]
  1.     'control
  2.     kw = _KEYDOWN(119) OR _MOUSEBUTTON(1): ks = _KEYDOWN(115) OR _MOUSEBUTTON(2): ka = _KEYDOWN(97): kd = _KEYDOWN(100): et_ir = (ABS(ka OR kd OR kw) OR -ABS(ks))
  3.     ir = 0: IF inv_me10 = -1 THEN SWAP ka, kd
  4.     FOR elt1 = 0 TO max_couch STEP 2: FOR elt2 = 0 TO 360 STEP 12: IF ir = 0 THEN
  5.                 elt_xy = SIN(elt2 * pip180) * elt1: elt_z = COS(elt2 * pip180) * elt1
  6.                 szog_xy_elt = -90 * ABS(ka) + 90 * ABS(kd): szog_xy = me(10) + (szog_xy_elt + elt_xy) * pip180: szog_z = me(11) + pip180 * (90 + elt_z)
  7.                 irx = -SIN(szog_xy) * COS(szog_z): iry = -COS(szog_xy) * COS(szog_z): irz = SIN(szog_z): ir = et_ir: multi = stepping * ir * pre_calc * 2
  8.                 multi = stepping * ir / max_couch * (max_couch - elt1): me(0) = me(0) + irx * multi: me(1) = me(1) + iry * multi
  9.     me(2) = me(2) + irz * multi: END IF: NEXT elt2, elt1
  10.  

LOL!

szog? has me irx'd elt kw'd, pip180 at least! ;-))
« Last Edit: March 15, 2021, 03:53:35 pm by bplus »

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: i suffer
« Reply #51 on: March 15, 2021, 03:58:31 pm »
I'll tell you honestly that I've gathered so many programs that I've just flipped through the controls and the display system. (copy/paste form 3d maze) The part of the program you copied is meant to make you go and hit a wall, so don’t stop, but look for the nearest direction. The larger the deviation, the slower the step will be. There is no space detection here, so there is no function for this part, but you can expand the program with space detection in an instant.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: i suffer
« Reply #52 on: March 15, 2021, 04:25:05 pm »
the larger the "try", so the deviation, the magnitude of the displacement, will be smaller. given by the "multi" variable. The drawing shows the operation in 2d, in the program in 3d.

  [ You are not allowed to view this attachment ]  

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: i suffer
« Reply #53 on: March 29, 2021, 02:21:56 am »
Here I wanted to see the spacecraft go and those rocks or planets, the bigger, the bigger their gravitational field. You can have fun with the mouse. The left mouse gives the gas to the spaceship. Here you can have fun with the landing, or when you pass a planet, you can feel how much you need to change the trajectory (drag your mouse) to avoid crashing. You can zoom with the mouse wheel.

Code: QB64: [Select]
  1. CONST pip180 = 3.141592654 / 180
  2.  
  3. global_speed = 1.5
  4. space_grav = 15
  5. space = 1000 'space size x-y
  6. planets = 600
  7. planetsize_min = 1
  8. planetsize_max = 12
  9. planet_dif = .05
  10. cr_c_max = 199
  11. zoom = 10
  12. me_buffer_size = 5000
  13.  
  14. 'creating 2d planet
  15. DIM cr(planets - 1, cr_c_max - 1, 1), cr_dat(planets - 1, 3), me_buffer(me_buffer_size - 1, 1)
  16. 'cd_dat 0-x,1-y,2-size,3-polars
  17. FOR aplanet = 0 TO planets - 1
  18.     cr_dat(aplanet, 2) = planetsize_min + (planetsize_max - planetsize_min) * RND(1) 'planet size
  19.     cr_l1 = (1 - planet_dif) * cr_dat(aplanet, 2)
  20.     cr_l2 = (1 + planet_dif) * cr_dat(aplanet, 2)
  21.     cr_dat(aplanet, 0) = space * RND(1) - space / 2 'X position
  22.     cr_dat(aplanet, 1) = space * RND(1) - space / 2 'Y position
  23.     cr_dat(aplanet, 3) = INT(cr_dat(aplanet, 2) * 6) 'polars
  24.  
  25.     FOR t = 0 TO cr_dat(aplanet, 3) - 1
  26.         cr_r = cr_l1 + (cr_l2 - cr_l1) * RND(1)
  27.         cr(aplanet, t, 0) = SIN(360 / cr_dat(aplanet, 3) * t * pip180) * cr_r
  28.         cr(aplanet, t, 1) = COS(360 / cr_dat(aplanet, 3) * t * pip180) * cr_r
  29. NEXT t, aplanet
  30.  
  31.  
  32.  
  33.  
  34. me_x = 0 'my Xpos
  35. me_y = 0 'my Ypos
  36. me_a = 30 'my angle
  37. me_size = 2 'arrow size
  38. me_size_a = .4
  39.  
  40. mon = _NEWIMAGE(800, 600, 32): SCREEN mon: _FULLSCREEN: _MOUSEHIDE
  41. centx = _WIDTH(mon) / 2: centy = _HEIGHT(mon) / 2
  42.  
  43.  
  44.  
  45.     'draw me
  46.     y1 = centy - me_size / 2 * zoom
  47.     y2 = y1 + me_size * zoom
  48.     LINE (centx, y1)-(centx, y2)
  49.     y2 = y1 + me_size_a * zoom
  50.     LINE (centx, y1)-(centx - me_size_a * zoom, y2)
  51.     LINE (centx, y1)-(centx + me_size_a * zoom, y2)
  52.  
  53.  
  54.     'my position center, but where any object ?
  55.  
  56.     grav_x = 0: grav_y = 0: grav_active = 0
  57.  
  58.     FOR aplanet = 0 TO planets - 1
  59.         angle1 = degree(me_x - cr_dat(aplanet, 0), me_y - cr_dat(aplanet, 1)) 'how many degree
  60.         angle2 = angle1 + angle_me '+arrow
  61.  
  62.         distance = SQR((me_x - cr_dat(aplanet, 0)) ^ 2 + (me_y - cr_dat(aplanet, 1)) ^ 2)
  63.  
  64.         cr_cx = (SIN(angle2 * pip180)) * distance 'planet origo position on monitor
  65.         cr_cy = (COS(angle2 * pip180)) * distance
  66.  
  67.         FOR t = 0 TO cr_dat(aplanet, 3)
  68.             IF t = cr_dat(aplanet, 3) THEN t2 = 0 ELSE t2 = t
  69.             px = cr(aplanet, t2, 0)
  70.             py = cr(aplanet, t2, 1)
  71.             angle_r = angle_me * pip180
  72.             px2 = (px * COS(angle_r)) + (py * SIN(angle_r))
  73.             py2 = (py * COS(angle_r)) - (px * SIN(angle_r))
  74.             px = (px2 + cr_cx) * zoom + centx
  75.             py = (py2 + cr_cy) * zoom + centy
  76.             IF t THEN LINE (px, py)-(px_l, py_l)
  77.             px_l = px: py_l = py
  78.         NEXT t
  79.  
  80.         'gravity planet
  81.         IF distance < space / 100 * space_grav THEN
  82.             grav_active = grav_active + 1
  83.             gravity = cr_dat(aplanet, 2) ^ 2 / distance ^ 2
  84.             'IF gravity > .01 THEN gravity = .01
  85.             grav_x = grav_x + SIN(angle1 * pip180) * gravity
  86.             grav_y = grav_y + COS(angle1 * pip180) * gravity
  87.  
  88.         END IF
  89.     NEXT aplanet
  90.  
  91.     'draw my way
  92.     FOR a_buff = 0 TO me_buffer_size - 1: IF me_buffer(a_buff, 0) = 0 THEN _CONTINUE
  93.         angle1 = degree(me_x - me_buffer(a_buff, 0), me_y - me_buffer(a_buff, 1)) 'how many degree
  94.         angle2 = angle1 + angle_me '+arrow
  95.  
  96.         distance = SQR((me_x - me_buffer(a_buff, 0)) ^ 2 + (me_y - me_buffer(a_buff, 1)) ^ 2)
  97.  
  98.         cr_cx = (SIN(angle2 * pip180)) * distance 'planet origo position on monitor
  99.         cr_cy = (COS(angle2 * pip180)) * distance
  100.  
  101.         PSET (centx + cr_cx * zoom, centy + cr_cy * zoom)
  102.     NEXT a_buff
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.     'control
  110.     mw = 0: mousex = 0: WHILE _MOUSEINPUT: mousex = mousex + _MOUSEMOVEMENTX: mw = mw + _MOUSEWHEEL: WEND: angle_me = angle_me + mousex
  111.     IF _MOUSEBUTTON(1) THEN speed = speed + .05
  112.     IF _MOUSEBUTTON(2) THEN speed = speed - .05
  113.  
  114.  
  115.  
  116.     'inertia vector
  117.     speed = speed - .01 * SGN(speed)
  118.     IF ABS(speed) > .5 THEN speed = .5 * SGN(speed)
  119.  
  120.  
  121.     vector_x_my = -SIN(pip180 * angle_me) * speed * global_speed
  122.     vector_y_my = -COS(pip180 * angle_me) * speed * global_speed
  123.  
  124.  
  125.     'gravity vector
  126.     angle_g = degree(grav_x, grav_y)
  127.     strong = SQR((grav_x - me_x) ^ 2 + (grav_y - me_y) ^ 2): IF strong > 2 THEN strong = 2
  128.     IF ABS(strong) > 1 THEN strong = 1 * SGN(strong)
  129.     vector_x_grav = -SIN(pip180 * angle_g) * strong / 5 * global_speed
  130.     vector_y_grav = -COS(pip180 * angle_g) * strong / 5 * global_speed
  131.  
  132.     'resulting vector
  133.     me_x = me_x + vector_x_my + vector_x_grav
  134.     me_y = me_y - vector_y_my + vector_y_grav
  135.  
  136.     IF me_x > space / 2 THEN me_x = me_x - space
  137.     IF me_x < -space / 2 THEN me_x = me_x + space
  138.     IF me_y > space / 2 THEN me_y = me_y - space
  139.     IF me_y < -space / 2 THEN me_y = me_y + space
  140.  
  141.     me_buffer(me_buffer_a, 0) = me_x
  142.     me_buffer(me_buffer_a, 1) = me_y
  143.  
  144.     me_buffer_a = me_buffer_a + 1: IF me_buffer_a = me_buffer_size THEN me_buffer_a = 0
  145.  
  146.     zoom = zoom + mw / 2
  147.     IF zoom > 50 THEN zoom = 50
  148.     IF zoom < .5 THEN zoom = .5
  149.  
  150.  
  151.     'view
  152.     _DISPLAY: CLS
  153.     'LOCATE 1, 1
  154.     'PRINT speed, SQR(grav_x ^ 2 + grav_y ^ 2)
  155.     '    PRINT "grav_active:"; grav_active
  156.  
  157.  
  158.  
  159.  
  160. FUNCTION degree (a, b)
  161.     qarany = (a + .00001) / (b + .00001): degree = honnan + ATN(qarany) / pip180
  162.     IF 0 > b THEN degree = degree - 180
  163.     IF degree < 0 THEN degree = degree + 360
  164.  
  165.  

Offline Aurel

  • Forum Regular
  • Posts: 167
    • View Profile
Re: i suffer
« Reply #54 on: March 29, 2021, 08:27:39 am »
wow that is fast mouse move progie
but how to close program ??? ESC not work???
//////////////////////////////////////////////////////////////////
https://aurelsoft.ucoz.com
https://www.facebook.com/groups/470369984111370
//////////////////////////////////////////////////////////////////

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: i suffer
« Reply #55 on: March 29, 2021, 11:50:37 am »
@Aurel Alt + F4 works, something to keep in mind for all these people who want full screen and forget about escape.

@MasterGy  very interesting, thanks :)  Interesting is you are getting the direction of mouse moves without tan, atan, or atan2 and instead of changing direction of mouse you change whole orientation of screen which is disorienting ;-)) but I wonder if smoother than my mouse action shooter? Also nice is doing so much with so little code!
« Last Edit: March 29, 2021, 11:59:49 am by bplus »

FellippeHeitor

  • Guest
Re: i suffer
« Reply #56 on: March 29, 2021, 12:02:11 pm »
It feels like this thread should have been several many separate threads. @MasterGy Maybe a new thread should be started if the new code has no correlation with the previous.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: MasterGy is looking for ideas to implement ("i suffer")
« Reply #57 on: March 29, 2021, 12:07:40 pm »
It feels like this thread should have been several many separate threads. @MasterGy Maybe a new thread should be started if the new code has no correlation with the previous.

What is in common is that when an artist suffers he gets creative just to cheer himself up.

You've got to admit these are some very creative cheers :)

FellippeHeitor

  • Guest
Re: MasterGy is looking for ideas to implement ("i suffer")
« Reply #58 on: March 29, 2021, 12:12:02 pm »
It would be a shame if this ended up containing several cool looking pieces of code-art but ended up buried under the cryptic title "i suffer".

Much like all your new "tools" end up buried under "another one for your toolbox".

With no clear description of what the thread/post actually contains, content gets lost - not that that's not already a characteristic of forum boards, but we could at least make it more easily searchable.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: MasterGy is looking for ideas to implement ("i suffer")
« Reply #59 on: March 29, 2021, 12:12:25 pm »
I agree with Fellippe. This thread seems like it has taken a few different directions from when it was first created.
Shuwatch!